fetch first

//master branch에 push한다. git push origin master //fatal: The current branch master has no upstream branch. 브랜치가 원격저장소에 없을경우 발생 git push -u origin master //-u 원격저장소에 master라는 branch를 생성하고 push한다. ! [rejected] master -> master (fetch first) 이미 변경된 파일이 원격저장소에 있을경우 발생 git pull origin master //pull - 원격저장소의 내용을 가져와 로컬저장소의 내용과 자동으로 병합작업을 수행한다. //fetch - 원격저장소의 내용을 확인만 하고 로컬저장소의 내용과 병합작업을 수행하지 않는다.

원인

다른 누군가 master로 이미 push를 한상태에서 커밋을 했을떄 발생하는 에러

해결

fetch로 변경사항을 확인후 merge로 합치고 다시 push하면 된다.

 

출처: https://stackoverflow.com/questions/28429819/rejected-master-master-fetch-first

 

! [rejected] master -> master (fetch first)

Is there a good way to explain how to resolve "! [rejected] master -> master (fetch first)'" in Git? When I use this command $ git push origin master it display an error message. ! [rejected...

stackoverflow.com

 

! [rejected] master -> master (fetch first)

Is there a good way to explain how to resolve "! [rejected] master -> master (fetch first)'" in Git? When I use this command $ git push origin master it display an error message. ! [rejected...

stackoverflow.com

not-fast-forward

git push -u origin master ! [rejected] master -> master (non-fast-forward)

원인

원격 저장소와 로컬 저장소간에 공통 분모가 없는 상태에서 병합을 시도하여 발생하는 에러.

관련 없는 두 저장소를 병합하는 것은 안되도록 기본설정이 되어있다.

해결

git pull origin master --allow-unrelated-histories

위와 같이 관련없는 두 저장소의 병합을 허락해주도록 설정.

 

+ Recent posts