오랜만에 새로운 저장소를 사용하려 하니, 잘 되던 git push가 안되어 원인을 분석해보았다.
1
2
3
4
5
6
7
8
|
C:\Users\gitProject>git push origin master
To https://github.com/userId/userProject.git
! [rejected] master -> master (non-fast-forward)
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.
|
cs |
왜 일까???
git pull로 땡겨와봤는데 여전히 아래처럼 오류가 발생한다.
1
2
3
4
|
$ git pull origin master
From github.com:userID/userProject
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories
|
cs |
fatal: refusing to merge unrelated histories
병합을 거부한다라...
찾아보니 해결방법은 의외로 간단했다.
1
|
git pull origin 브런치명 --allow-unrelated-histories
|
cs |
--allow-unrelated-histories 라는 옵션을 같이 입력해주면
git에서 기본적으로 거부하는 서로 관련 기록이 없는 이질적인 두 프로젝트를 허용해줌으로써,
이후 git push도 정상적으로 진행된다.
오늘도 하나 배워간다!! 아자!
반응형
'코딩 | 개념 정리 > Git & GitHub' 카테고리의 다른 글
[GitHub] ssh: connect to host github.com port 22: Connection timed out (0) | 2022.04.20 |
---|---|
vi 편집기 정리 (0) | 2022.01.26 |
1day 1commit 프로젝트, github에서 발생하는 contribution 에러 (0) | 2021.07.17 |
GIT 기초 사용법 3_원격 저장소 (0) | 2021.07.14 |
git의 원리 분석 도구_gistory 사용법 (0) | 2021.07.13 |