zoukankan      html  css  js  c++  java
  • git 出现 fatal: refusing to merge unrelated histories 错误

    背景

    git pull失败,提示: fatal: refusing to merge unrelated histories 

    根本原因

    因为两个根本不相干的 git 库, 一个是本地库, 一个是远端库, 然后本地要去推送到远端, 远端觉得这个本地库跟自己不相干, 所以告知无法合并

    解决方案一

    git clone远程仓库到本地,将需要推送的内容放到该仓库下 , 然后提交上去 , 这样算是一次update操作

    解决方案二

    使用强制命令

    git pull origin master --allow-unrelated-historie 

    后面加上 --allow-unrelated-histories  , 把两段不相干的分支进行强行合;这里可能会进入一个编辑页面,只需要先ESC,然后敲:q! 即可

    后面再push就可以了 git push -u origin master 

  • 相关阅读:
    windows平台下一款强大的免费代理获取工具
    彻底搞懂Git Rebase
    line-height
    text-indent
    text-decoration
    text-align
    color
    CSS属性汇总
    font
    font-style
  • 原文地址:https://www.cnblogs.com/poloyy/p/12222187.html
Copyright © 2011-2022 走看看