在碼雲上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