개발관련/Git

GitHub에 푸시 할 수 없음-병합이 필요하다고 계속 말합니다.

Rateye 2021. 6. 5. 13:31
728x90
반응형
질문 : GitHub에 푸시 할 수 없음-병합이 필요하다고 계속 말합니다.

저는 GitHub를 처음 사용합니다. 오늘 나는 GitHub에 코드를 푸시하려고 할 때 몇 가지 문제를 만났습니다.

Pushing to git@github.com:519ebayproject/519ebayproject.git To git@github.com:519ebayproject/519ebayproject.git  ! [rejected]        master -> master (non-fast-forward) error: failed to push some refs to 'git@github.com:519ebayproject/519ebayproject.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Merge the remote changes (e.g. 'git pull') hint: before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. 

아직 리포지토리에 아무것도 푸시하지 않았는데 왜 무언가를 가져와야합니까?

답변

원격 브랜치를 로컬 브랜치에 병합하지 않고 ( git diff 와의 차이점 참조) 강제 푸시를 수행하려면 -f와 함께 push 명령을 사용하십시오.

git push -f origin <branch> 

여기서 origin 은 원격 저장소의 이름입니다.

일반적으로 명령은 덮어 쓰는 데 사용 된 로컬 참조의 조상이 아닌 원격 참조를 업데이트하는 것을 거부합니다. 이 플래그는 검사를 비활성화합니다. 이로 인해 원격 저장소에서 커밋이 손실 될 수 있습니다. 주의해서 사용하십시오.

 

출처 : https://stackoverflow.com/questions/10298291/cannot-push-to-github-keeps-saying-need-merge
728x90
반응형