首页 > 其他 > 详细

解决 fatal: refusing to merge unrelated histories

时间:2019-11-30 15:08:09      阅读:57      评论:0      收藏:0      [点我收藏+]
Git 的报错

一、fatal: refusing to merge unrelated histories

新建了一个仓库之后,把本地仓库进行关联提交、拉取的时候,出现了如下错误:

ankobot@DESKTOP-9IUDMKP MINGW64 /e/workspace/firmware_upload/firmware_upload (master)
$ git pull
fatal: refusing to merge unrelated histories

二、解决方案

在你操作命令后面加 --allow-unrelated-histories
例如:

git merge master --allow-unrelated-histories
$ git pull --allow-unrelated-histories
CONFLICT (add/add): Merge conflict in .gitignore
Auto-merging .gitignore
Automatic merge failed; fix conflicts and then commit the result.

我这里由于使用了官方的 .gitignore 自动合并失败,需要手动合并之后再进行 add、commit 即可

如果你是git pull或者git push报fatal: refusing to merge unrelated histories
同理:
git pull origin master --allow-unrelated-histories / git pull --allow-unrelated-histories
等等,就是这样完美的解决!

解决 fatal: refusing to merge unrelated histories

原文:https://blog.51cto.com/laok8/2454524

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!