error: failed to push some refs【Linux】【Git】


To https: // name@bitbucket.org/name/mywork.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to  ' https://name@bitbucket.org/name/mywork.git '
To prevent you  from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the  ' Note about
fast-forwards '  section of  'git push --help '  for details.

使用git push時提示錯誤信息如下,通過git push --help 然后/fast-forwards后查看很多有關信息,但未能找到解決方法。

google后,發現是由於遠程倉庫中代碼版本與本地不一致沖突導致的。

解決:

git pull

再自動merge或手動merge沖突

再次git push

成功解決問題。

 

參考:

[1]  You can also force a push by adding the + symbol before your branch name.

[2] http://stackoverflow.com/questions/3598355/i-am-not-able-to-push-on-git

[3] Managing remotes of GitHub Help (推薦閱讀)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM