当前位置:   article > 正文

git push时rejected,解决non-fast-forward errors的办法_git push rejected

git push rejected

问题:

在git push时无法推送到远端仓库,出现下面的信息

$ git push origin master
To https://github.com/USERNAME/REPOSITORY.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to ‘https://github.com/USERNAME/REPOSITORY.git’
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. ‘git pull’) before pushing again. See the
‘Note about fast-forwards’ section of ‘git push --help’ for details.

git官网上基于此提出的问题背景是
Sometimes, Git can’t make your change to a remote repository without losing commits. When this happens, your push is refused.If another person has pushed to the same branch as you, Git won’t be able to push your changes.
即远端仓库有了比你本地分支更新的commit,不允许你的此次修改直接推送到远端分支。

解决方案:

方案一:官网上给出的方法是
fix this by fetching an

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/533079
推荐阅读
相关标签
  

闽ICP备14008679号