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.
! [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 (推薦閱讀)