Git解决 fatal: refusing to merge unrelated histories

这篇具有很好参考价值的文章主要介绍了Git解决 fatal: refusing to merge unrelated histories。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

一、fatal: refusing to merge unrelated histories

新建了一个本地仓库之后,把本地仓库和远程仓库进行关联提交、拉取的时候,

出现了如下错误:

$ git pull origin master

remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 9 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (9/9), 786 bytes | 34.00 KiB/s, done.
From gitee.com:llliyuheng/1111
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
fatal: refusing to merge unrelated histories

二、解决方案

在你的操作命令后面加 --allow-unrelated-histories

例如:

$ git merge master --allow-unrelated-histories

如果你是git pull或者git push报fatal: refusing to merge unrelated histories

同理:

git pull origin master --allow-unrelated-histories / git pull --allow-unrelated-histories

等等,就是这样完美的解决pofei!

--文章来源地址https://www.toymoban.com/news/detail-735918.html

到了这里,关于Git解决 fatal: refusing to merge unrelated histories的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • git merge 提示错误 fatal: refusing to merge unrelated histories

    拉去远程分支代码报错:fatal: refusing to merge unrelated histories 造成的原因是: 1、本地项目copy 其他项目的结构把.git 文件可拷贝过来了 且覆盖了自己当前目录的 .git 文件,然后将当前分支合远程分支合并 因为两个 .git 文件储存库的历史数据不一致,合并分支就会报这个错误;

    2023年04月18日
    浏览(28)
  • git pull 提示错误 fatal: refusing to merge unrelated histories

    从远程拉项目到本地的时候提示错误 造成 fatal: refusing to merge unrelated histories错误的原因有以下几点: 有一个包含一些提交的新 Git 存储库。然后,您尝试从现有的远程仓库中提取。合并变得不兼容,因为分支和远程拉取的历史不同。当你试图合并两个完全不相关的分支时,

    2024年02月11日
    浏览(33)
  • 【Git】merge时报错:refusing to merge unrelated histories

    今天将feature分支合并到master时报错:refusing to merge unrelated histories(拒绝合并无关历史) 报错原因:当尝试从远程仓库\\\"gitee.com:zpg13/system_school\\\"的master分支拉取最新更新并合并到本地的master分支时,Git拒绝了这次合并,原因是两个分支拥有不相关的历史记录。 这种方法会保留

    2024年03月25日
    浏览(43)
  • idea使用git提交代码报异常refusing to merge unrelated histories和unknown option `allow-unrelated-histories‘

    目录  一、异常refusing to merge unrelated histories 二、异常unknown option `allow-unrelated-histories\\\' 使用git提交代码的时候报异常:refusing to merge unrelated histories 解决方法: 这个错误通常是因为两个不同的Git仓库被合并了,而且它们之间没有共同的祖先。这可能会发生在以下情况下: 你在

    2024年02月13日
    浏览(27)
  • 解决Git报错fatal: couldn‘t find remote ref –-allow-unrelated-histories 的解决办法

    当执行git中的“git pull origin master –allow-unrelated-histories”命令时, 如果出现 fatal: couldn\\\'t find remote ref –-allow-unrelated-histories 的错误,输入如下命令即可解决: git pull --rebase origin master git push origin master 点赞 -收藏-关注-便于以后复习和收到最新内容 有其他问题在评论区讨论-或

    2024年02月13日
    浏览(29)
  • 解决git报错:fatal: unable to access ‘xxx/‘: Failed to connect to 127.0.0.1 port 7890: Connection refused

    前言:Linux系统,使用vscode进行远程连接。 git push -u origin main 的时候,出现了如下问题: 无法连接到127.0.0.1 port 7890,连接被拒绝了。百度大法后基本上是取消代理即可: 但是我在终端中输入命令运行后,会出现一个红叉: 命令无法运行。 可能是之前设置过代理的名字不是

    2024年02月15日
    浏览(54)
  • 使用Git时 出现couldn‘t find remote ref-allow-unrelated-histories的解决办法

    当执行git中的“git pull origin master –allow-unrelated-histories”命令时,会出现“ couldn’t find remote ref –allow-unrelated-histories”的错误, 可以简单理解为我们的远程仓库与本地仓库的内容不对等造成的。 特别容易发生在 我们新建了一个文件夹,往git仓库中上传资料的ing况下,如下

    2024年02月11日
    浏览(36)
  • git push 出现fatal: unable to access…not resolve host:…报错的多方面原因及解决方法 Merge branch 'master' of ...

    在git push -u origin \\\"master\\\"出现以下报错 fatal: unable to access  https://gitee.com.…….git/ : Could not resolve host: gitee.com.…… 在网上查阅、试了各种办法,都解决不了,最后发现自己有如下一些错误,也不知道哪一个导致了这样的结果,但是都更改后成功提交了。 1、我发现我刚注册的账

    2024年02月16日
    浏览(43)
  • 【git】ssh: connect to host github.com port 22: Connection refused fatal: Could not read from remote r

    之前github的ssh的公私钥已经配置好,并可以正常使用,可没过多久,有一天突然报错: ssh: connect to host github.com port 22: Connection refused fatal: Could not read from remote repository. git 远程仓库两种协议:ssh,https。 在解决问题之前,先要了解git远程仓库的两种协议连接。 ssh协议连接gi

    2024年01月20日
    浏览(37)
  • 解决:git出现Failed to connect to 127.0.0.1 port 1080 Connection refused 的报错

    使用git将代码push到远程仓库时,一直都出现端口代理的问题。 完成了以上两个步骤后,还是没有解决,但是报错的信息发生了变化。出现了如下的错误。 ​ 结果如下图,检查出有网络问题,需要解决网络问题。 一.需要在hosts文件中添加映射 1.hosts文件存在于: C:WindowsSy

    2024年02月15日
    浏览(51)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包