老宋的地盘

 找回密码
 我要加入
搜索
老宋 首页 文章 技术 查看内容

fatal: refusing to merge unrelated histories

2023-6-2 15:10| 发布者: herosrx| 查看: 103| 评论: 0

摘要: Git 的报错一、fatal: refusing to merge unrelated histories新建了一个仓库之后,把本地仓库进行关联提交、拉取的时候,出现了如下错误:fatal: 'master' does not appear to be a git repository fatal: Could no ...

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

fatal: 'master' does not appear to be a git repository
fatal: Could not read from remote repository.

二、解决方案
在你操作命令后面加 --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


路过

雷人

握手

鲜花

鸡蛋

相关阅读

最新评论

歌名 - 歌手
0:00

    QQ|手机版|小黑屋|老宋 ( 备案中... )

    GMT+8, 2024-4-29 16:08 , Processed in 0.051446 second(s), 19 queries , Gzip On.

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

    返回顶部