새 repository를 만들때 ignore 또는 readme를 추가하고 바로

git pull origin master

를 하고 프로젝트를 시작한다면 문제가 없지만, 이미 진행중이던 프로젝트가 있는 경우 충돌이 발생한다.

에러 코드는 다음과 같다.

! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/?????/server-study.git'
hint: Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

다음 명령어로 해결할 수 있다.

git pull origin master --allow-unrelated-histories

다만 이 방법은 강제로 merge시키는 방법이기 때문에 처음 git과 연동할 때 충돌로 인한 문제를 해결할 때 외에는 사용을 추천하지 않는다.

+ Recent posts