idea提交代码时报错Git Pull Failed: refusing to merge unrelated histories

Posted duhl1024

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了idea提交代码时报错Git Pull Failed: refusing to merge unrelated histories相关的知识,希望对你有一定的参考价值。

原因:

本地仓库和远程仓库实际上是独立的两个仓库,如果是先创建远程库,再提交本地的仓库到远程库,就会容易出现这个问题。一般都是远程仓库添加readMe.md 或者其他新增的文件导致。

 

解决方法:在项目目录下执行

git pull origin master --allow-unrelated-histories 

以上是关于idea提交代码时报错Git Pull Failed: refusing to merge unrelated histories的主要内容,如果未能解决你的问题,请参考以下文章

IDEA新建项目提交到git仓库时报错:Can't Update No tracked branch configured for branch master or the branch...

eclipse git pull拉代码时报错:cannot open git-upload-pack

git提交时报错:Updates were rejected because the tip of your current branch is behind

git学习解决git提交代码时报错: Unable to create ‘XXX/.git/index.lock‘: File exists.

git学习 idea git pull 解决冲突

git学习解决git提交代码时报错: Unable to create ‘XXX/.git/index.lock‘: File exists.