개념 공부/기타
[Git] 현재 레포를 강제로 리셋하고, 다시 푸시하기
clean01
2020. 8. 4. 20:01
git push -u origin master
To https://github.com/제 닉넴/MovieLine.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/제 닉넴/MovieLine.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
1학년 1학기 과목 최종 프로젝트를 예전에 원격저장소에 수동으로 업로드했다가, 그러면 사진이 안 올라가서 커맨드로 업로드하려고 했는데, push가 안 되었다.
이유는 이 원격저장소에 전에 로컬을 통해서(?) 업로드 하지 않은 파일이 있어서라고 했다.
즉 커맨드로 push한게 아니라 직접 깃헙에 들어가서 파일을 올려서 그런 것 같다.
그래서 그냥 레포를 비우고 다시 올리기로 했다. 어차피 똑같은 내용이므로
원격 저장소를 비우고, 새로 푸시하는 명령어이다.
git push --force --set-upstream origin master