git push 오류 : Updates were rejected because the tip of your current branch is behind

DDOL9·2024년 6월 12일

넹글넹글

목록 보기
1/4

발생한 오류

힌트: Updates were rejected because the tip of your current branch is behind
힌트: its remote counterpart. If you want to integrate the remote changes,
힌트: use 'git pull' before pushing again.
힌트: See the 'Note about fast-forwards' in 'git push --help' for details.

이미 PR을 날린 상태에서 변경사항을 추가로 커밋 후 push하려니 발생한 에러
구글링해보니 나와 전혀 상관 없는 케이스 (README오류) 이거나, -f를 사용해서 강제로 push하라는 얘기밖에 없었다..

팀 프로젝트라 강제로 push했다간 어떤 참사가 일어날지 모르기 때문에 다양한 시도를 다 해보았으나 실패
dev pull도 다시 해보고 rebase도 해봤으나 계속 같은 오류 발생 ㅠㅠ


해결 방법

https://docs.github.com/ko/get-started/using-git/dealing-with-non-fast-forward-errors

깃헙독스에 생각보다 많은 오류 해결법들이 있다!

$ git fetch origin
# Fetches updates made to an online repository
$ git merge origin YOUR_BRANCH_NAME
# Merges updates made online with your local work

이 방법대로 해봤는데,
git fetch는 에러가 뜨고 git merge는 이미 업데이트 된 상태라는 안내창이 떴다.
그런데 다시 git pull을 해보니 갑자기 해결됨 ㅡ.ㅡ

이게 왜 된거지????
일단 해결됐으니 기록해두기

profile
난.. ㄱㅏ끔.. 알코올을 흘린ㄷr..

0개의 댓글