当前位置:   article > 正文

解决Git问题fatal: refusing to merge unrelated histories

fatal: refusing to merge unrelated histories

解决Git问题fatal: refusing to merge unrelated histories

一、fatal: refusing to merge unrelated histories

今天在创建远程仓库,关联远程仓库后pull下来的时候失败

λ git pull
fatal: refusing to merge unrelated histories
  • 1
  • 2

fatal: refusing to merge unrelated histories
这里的问题的关键在于:fatal: refusing to merge unrelated histories
你可能会在git pull或者git push中都有可能会遇到,因为这两个分支可能没有取得联系。那么怎么解决呢?

二、解决方案

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

git pull origin master --allow-unrelated-histories
  • 1
Administrator/My-demo (master)
$ git pull origin master --allow-unrelated-histories
From gitee.com:tuogu/typescript-demo
 * branch            master     -> FETCH_HEAD
Merge made by the 'recursive' strategy.
  • 1
  • 2
  • 3
  • 4
  • 5

如果你是git merge 报fatal: refusing to merge unrelated histories
同理:

git merge master --allow-unrelated-histories
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/592858
推荐阅读
相关标签
  

闽ICP备14008679号