[git] push, pull이 되지 않는 경우
원격 저장소를 clone하는 경우에는 괜찮지만 로컬 저장소를 먼저 만들고 나중에 원격 저장소를 연결한 경우에 git push -u origin main 명령어를 입력하면error: failed to push some refs to 라고 나오면서 거절이 된다. pull을 먼저 해야하는데 이 경우에는 git pull origin main을 입력을 해도fatal : refusing to merge unrelated histories 라고 나오면서 pull 역시 되지 않는다. 이 경우에는 git pull origin main --allow-unrelated-histories 옵션을 주어 pull을 먼저 진행해야한다. 이후에 다시 git push 명령을 통해 정상적으로 push가 되는 것을 확인할 수 있다.
VCS
2024. 8. 12. 10:05