在码云上git push时报错,出现error: failed to push some refs to 'https://gitee.com/lipengyangzuishuai/gitstudy.git'的解决办法


1.使用 git remote add 别名 远程地址 命令起别名,查看当前所有远程地址别名

2.创建hello.txt

 

3.使用 git push 别名 分支  命令推送失败

 

 

 

4.使用git pull 远程地址别名 master --allow-unrelated-histories

根据错误提示 用git pull 将远程仓库的内容pull下来

无奈pull下来后再push还是报上述错误

 

网上查找资料 找到了下面的解决办法

在当前本地仓库下用git bash输入下面命令

git pull git-demo2 master --allow-unrelated-histories

此时会有一个弹窗,提示你修改一个文档的内容,不用管他,按ESC键

再按SHIFT+;  (SHIFT+;用来输入一个冒号)  再输入wq保存

:wq

 

5.使用 git push 别名 分支  命令

 git push git-demo2 master
  •  注意
    • git push git-demo2 master  git-demo2是我的远程仓库名字已经被我修改了,默认的一般为origin

       

       

      出现上面提示表示push到远程仓库成功

原文:https://www.cnblogs.com/xiaoyuzhou55/p/9517987.html


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM