Git push 해결 중 error: failed to push some refs to...

2052 단어 개발 도구
오늘 git push origin master 오류:
$ git push origin master
To github.com:xiaoyangLee/LearnJava.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to '[email protected]:xiaoyangLee/LearnJava.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.

원격 창고의 파일과 로컬 창고의 차이가 있기 때문입니다. 예를 들어 원격 창고에 파일Readme가 있습니다.md, 그러나 로컬 창고가 없으면 이런 상황이 발생할 수 있습니다.
이런 상황이 발생한 이유는 다양하다. 예를 들어github로 파일을 업로드했거나 나처럼 이번에는 다른 시스템으로 파일을 전송해서 문제가 생겼다.해결 방법은 분명히 있습니다. 로컬 창고를 삭제하고gitclone을 하나 더 사용하지만, 이런 방법은 분명히 취할 수 없습니다.
해결 방법:gitpull로 지점 합병
git pull --rebase origin master

gitpull 명령은 다른 저장소나 로컬 지점에서 가져와 통합하고 원격 호스트의 특정한 지점의 업데이트를 가져와 로컬 지정한 지점과 통합하는 데 사용됩니다.

좋은 웹페이지 즐겨찾기