본문 바로가기
IT study/06. selfStudy: code error

git error: Updates were rejected because the tip of your current branch is behind its remote counterpart.

by Lacuna028 2021. 8. 1.

1. 에러 발생

1) 발생한 오류 내역

Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes (e.g. 'git pull ...') before pushing again. See the 'Note about fast-forwards' in 'git push --help' for details.

 

 

2) 번역

현재 지점의 팁이 원격 지점 뒤에 있으므로 업데이트가 거부되었습니다. 다시 누르기 전에 원격 변경 사항(예: 'git pull...')을 통합합니다. 자세한 내용은 'git push --help'의 '빨리 감기 관련 참고'를 참조하십시오.

 

 

2. 해결 방법

git push 하기 전 레포지토리의 코드를 pull 하지 않아서 생긴 오류.

비록 나 혼자 쓰는 레포지토리이여도... 해당 작업을 해주어야 한다.

 

해결 방법은 간단하다. 레포지토리를 pull한 후 다시 push 하면 해결된다.

명령어는 아래와 같이 순차적으로 입력하면 된다

git pull origin master
git push --set-upstream origin master