git pull 사용하여 failed to push some refs to ‘https://github.com~ 에러해결

github에 push를 사용하다보면 아래와 같은 에러 메시지가 뜨는 경우가 있다.

error: failed to push some refs to ‘https://github.com/abcdxxx/abcqqqxxx.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.

이런 문제가 생기는 원인은 대부분 원격지(github)와 로컬(내컴퓨터) 사이에 데이터가 일치하지 않아서 생기는 문제다.

깃헙에서만 임의로 파일을 만들었거나 수정하게되면 내 컴퓨터에서 push할때 위와 같은 메시지를 만난다.

문제를 해결하는 방법은 내컴퓨터의 터미널에서 git pull을 해서 깃헙의 수정사항을 받아서 일치시켜주면 간단히 해결된다.

로컬의 브랜치와 원격지의 브랜치가 다를 경우에는 “git pull 브랜치명”을 사용해준다.

git pull git pull branchName git pull javascript/23

위와 같이 pull을 받은 후에 다시 push를 하게 되면 잘 될 것이다. 오늘은 간단히 github 에러사항에 대해 알아봤습니다.

답글 남기기

20 − 4 =