본문 바로가기
에러 해결

[Git] error: failed to push some refs to

by codnjs779 2022. 1. 4.
error: failed to push some refs to 'https://github.com/codnjs779/listApp.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.

git commit 을 하는 과정에서 오류가 발생했다. 원격 저장소와 로컬 저장소의 상태가 달라서 나는 오류인데 pull을 사용해서 상태를 동일하게 한 후 push를 해주면 오류가 해결된다. 

git pull [저장소주소] [브런치 이름]

위와 같은 명령어를 입력해주면 오류가 해결된다. 해결된 후 push를 다시 해주면 정상적으로 깃 헙 저장소에 커밋이 된 것을 확인해볼 수 있다.