상세 컨텐츠

본문 제목

깃허브 push 오류 failed to push some refs to

깃허브 사용법

by hongga 2023. 5. 10. 20:21

본문

안녕하세요 홍 가 입니다.

오늘은 깃허브 push오류인 failed to push some refs to 에 대하여 글을 적어보려고 합니다.

 ! [remote rejected] master -> master (failure)
error: failed to push some refs to 

 

git bash로 push 할 때 종종이 오류가 나올 때가 있다.

git pull origin master

git add .
git commit 0m "커밋 내용"
git push origin master

or

git push -f origin master
git push origin +master
git push -u origin +master

보통적으로 pull을 하고 다시 push를 하면 먹힌다.

하지만 나는 먹히지 않았다

강제 푸시 등등 많은 걸 해보았지만 먹히지 않았다.

 

 강제푸시 및 설정을 바꾸다가 잘못하면 이 커밋한 것들이 다 사라진다.

 

 

 

현재 시간 

이걸 고치기 위해 파일을 계속 변형 시켰다 .. 하지만 똑같이 오류가 나온다.

 

구글을 엄청 뒤적거렸다 깃허브 주소부터 설정 변경을 해도 다 안되었다.

 

주소도 없애고 다시 연결해서 해봐도 계속 똑같은 오류가 발생했었다.

 

 

There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> master

뭐 대충 브런치를 합친다? 그런뜻이다

왜 나한테 이런 일이 생긴 건지는 모르겠지만..

 

주로 2대의 컴퓨터로 작업 시 이렇게 나온다는데

흠...

 

병합을 해주는 코드이다. 이 방법을 추천해 줘서 이걸로 했다.

뭔가 될 거 같은 느낌이 들었다.

 

On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)

그러고 다시 파일을 다운해 보니까

이런 글이 나왔다

 

파일이 2개가 있다는 뜻이다.

 

 

진짜로 파일이 origin 위에 2개가 있었다 저

HEAD밑에 있는 파일을 지워줘야 한다고 해서

 

git reset HEAD^

로 파일을 지워주었다.

 

그 뒤로 push를 진행해 주니까 업로드가 되었고 log기록을 보니 잘 된 것을 확인할 수 있었다.

관련글 더보기