当前位置:   article > 正文

记录git拉取代码时报错:hint: Updates were rejected because the remote contains work that you do not

hint: updates were rejected because the remote contains work that you do not

在push的时候报错:error: failed to push some refs to ‘github.smec-cn.com:u3794/circulate-remind-service.git’

大致意思是当前仓库与远程仓库冲突,远程仓库的部分东西本地仓库没有,例如远程仓库有readme.md文档本地没有就会报错。

解决方法:git pull origin master --allow-unrelated-histories

然后就可以正常push了!

记录解决思路如下:

解决思路来自:https://blog.csdn.net/m0_51715325/article/details/121789720

git在push到远程仓库的时候报错Updates were rejected because the remote contains work that you do

报错截图

含义:
远程仓库的部分东西本地仓库没有,例如远程仓库有readme.md文档本地没有就会报错。
解决方法:
先拉取远程仓库的分支(一般为master)

git pull origin master

    
    
  • 1

再push

git push -u origin master

    在进行pull之后,报错:fatal: refusing to merge unrelated histories

    解决思路来自:https://blog.csdn.net/qq_41287158/article/details/120461485

    背景:由于公司进行了仓库迁移,同事直接把代码init推进了新的仓库地址,我想在本地代码上切换远程仓库地址进行拉取远端代码时出现报错“fatal: refusing to merge unrelated histories”,大概意思是:“拒绝合并不相关的历史记录”。

    在这里插入图片描述
    上网查了一下原因:原因是我本地的代码提交历史和远端的提交历史不一致导致的报错

    //可以允许不相关历史提,强制合并,确实解决了这个问题
    git pull origin master --allow-unrelated-histories
    
        
        
    • 1
    • 2
    声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/451152
    推荐阅读
    相关标签
      

    闽ICP备14008679号