[GitHub] git push가 안되는 경우 (fatal: refusing to merge unrelated histories)

Y_Y·2022년 11월 2일
0

GitHub

목록 보기
4/5

git push 시 다음과 같이 에러가 날 경우

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

push전에 pull을 진행해주어야 한다. 하지만
fatal: refusing to merge unrelated histories 다음과 같은 에러가 날 경우
git pull main 브런치명 --allowed-unrelated-histories 를 입력

--allowed-unrelated-histories 이 명령 옵션은 이미 존재하는 두 프로젝트의 기록(history)을 저장하는 드문 상황에 사용된다고 한다. 즉, git에서는 서로 관련 기록이 없는 이질적인 두 프로젝트를 병합할 때 기본적으로 거부하는데, 이것을 허용해 주는 것이다.

Reference

profile
남을 위해(나를 위해) 글을 쓰는 Velog

0개의 댓글