日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

git push異常整理 error: failed to push some refs to

作者:山聞愚 更新時間: 2022-04-10 編程語言

目錄

名稱與 refs/heads/xxx 沖突

non-fast-forward(不能快速跟進)


名稱與 refs/heads/xxx 沖突

$ git push origin HEAD:feature/xujingjian-20210318-xj-1.5.0-122187
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
To ssh://192.168.14.227:22/DefaultCollection/PSSCS/_git/app_peiwang_ionic_chat_2.0
 ! [remote rejected]   HEAD -> feature/xujingjian-20210318-xj-1.5.0-122187 (名稱與 refs/heads/feature 沖突)
error: failed to push some refs to 'ssh://192.168.14.227:22/DefaultCollection/_git/app_2.0'

這個異常提示信息很少,但已經指出了異常是“名稱與 refs/heads/feature 沖突”,feature是要push分支xujingjian-20210318-xj-1.5.0-122187所在的文件夾。為什么會提示它呢?為了搞明白去遠程倉庫檢查了一下,原來沒有feature這個文件夾。解決辦法:創建feature文件夾,或把分支Push到其他文件下面。

non-fast-forward(不能快速跟進)

$ git push origin HEAD:xujingjian-20210318-xj-1.5.0-122187        
To ssh://192.168.14.227:22/DefaultCollection/_git/app_2.0
 ! [rejected]          HEAD -> xujingjian-20210318-xj-1.5.0-122187 (non-fast-forward)
error: failed to push some refs to 'ssh://192.168.14.227:22/DefaultCollection/PSSCS/_git/app_peiwang_ionic_chat_2.0'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

這個異常是non-fast-forward(不能快速跟進),就是說遠程倉庫已經有比本地倉庫更新的commit?;蛟S是你的同事先一步提交了代碼。
解決辦法:

  • ?先git pull origin?xujingjian-20210318-xj-1.5.0-122187
  • 如果有文件沖突先合并沖突,然后再git add 、git commit 、git push

?

原文鏈接:https://blog.csdn.net/xjj1314/article/details/114981038

欄目分類
最近更新