더 알아보기/에러

[Error] git push origin master 시 failed to push some refs to 오류

은돌1113 2021. 12. 13. 20:17

Git에 팀원들끼지 push를 많이 하다 보니 아래와 같은 오류가 발생했다.

$ git push origin master
To https://github.com/eundol0519/cloneCodingProject.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/eundol0519/cloneCodingProject.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.
error: src refspec mater does not match any
error: failed to push some refs to 'https://github.com/eundol0519/cloneCodingProject.git'

이 오류의 원인은 깃의 원격 저장소와 현재 로컬 저장소가 동기화 되어 있지 않기 때문이다. 동기화 시켜주면 간단하게 해결 할 수 있다. 그래서 내가 해결한 방법은 git pull을 해서 동기화 시켜 준 후 git push origin master 해줬다.

git pull origin master or git pull

 

(참고한 사이트)

https://dh-dh.tistory.com/47

 

git 기본 명령어, failed to push some refs to에 대한 해결방법

git에 대한 기본적인 명령어와 흐름을 알아보자. 1. 로컬 저장소 만들기 - 파일들을 버전 관리할 장소(폴더)를 정한다. - 그 안에서 'git init'이라고 명령어를 친다. - 이상한 폴더, 파일들이 만들어

dh-dh.tistory.com