나는 같은 문제가 있었다. 문제는 원격으로 인해 이것을 막는 것입니다.
먼저 로컬 리포지토리를 만들었습니다. 나는 추가 LICENSE하고 README.md내 로컬과 헌신에 파일을.
그런 다음 원격 저장소를 원했기 때문에 GitHub에서 원격 저장소를 만들었습니다. 여기서는 "README를 사용하여이 저장소를 초기화합니다"를 확인하는 실수를 저질렀 습니다.
그래서 지금 내가 달렸을 때
git push --set-upstream origin master
나는 얻었다 :
error: failed to push some refs to 'https://github.com/lokeshub/myTODs.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.
이제 이걸 극복하기 위해
git pull origin master
아래 오류가 발생했습니다.
From https://github.com/lokeshub/myTODs
branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories**
나는 시도했다 :
git pull origin master --allow-unrelated-histories
결과:
From https://github.com/lokeshub/myTODs
* branch master -> FETCH_HEAD
Auto-merging README.md
CONFLICT (add/add): Merge conflict in README.md
Automatic merge failed;
fix conflicts and then commit the result.
해결책:
원격 저장소를 제거하고 새 파일을 만들었습니다 (파일을 제거하는 README것이 효과가 있다고 생각합니다 ). 그 후 아래가 작동했습니다.
git remote rm origin
git remote add origin https://github.com/lokeshub/myTODOs.git
git push --set-upstream origin master
git-rebase답변에 대한 플래그를 제공하는 동안 질문이 상황을 묻습니다git-merge