当前位置:   article > 正文

non-fast-forward_non-fast-forward csdn

non-fast-forward csdn
  1. 问题前提:
  2. 在github上新建project后,提交本地代码到远程仓库时,报以下错误:
  3. ! [rejected] master -> master (non-fast-forward)
  4. error: failed to push some refs to 'https://github.com/sssss/shop.git'
  5. hint: Updates were rejected because the tip of your current branch is behind
  6. hint: its remote counterpart. Integrate the remote changes (e.g.
  7. hint: 'git pull ...') before pushing again.
  8. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
  9. 问题(Non-fast-forward)的出现原因在于:git仓库中已经有一部分代码,所以它不允许你直接把你的代码覆盖上去。于是你有2个选择方式:
  10. 1,强推,即利用强覆盖方式用你本地的代码替代git仓库内的内容
  11. git push -f
  12. 2,先把git的东西fetch到你本地然后merge后再push
  13. $ git fetch
  14. $ git merge
  15. 若再不行,执行以下命令:
  16. git push -f origin master

 

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

闽ICP备14008679号