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.
! [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 (推荐阅读)