当修改了本地仓库后 提交代码时, 用 git push 提示以下错误
error:failed to push some refs to ...
Dealing with “non-fast-forward” errors
From time to time you may encounter this error while pushing:
$ git push origin master
To ../remote/
! [rejected] master -> master (non-fast forward)
error: failed to push some refs to '../remote/'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'non-fast forward'
section of 'git push --help' for details.
解决办法:
先把git的东西fetch到你本地然后merge后再push
$ git fetch
$ git merge
$ git push

本文介绍了解决Git中遇到的非快进更新错误的方法。当你尝试推送更改到远程仓库时,可能会遇到此类错误。文章提供了具体的步骤来解决这个问题:首先从远程仓库获取最新数据,然后将这些更改合并到你的分支,最后再次尝试推送。
1353

被折叠的 条评论
为什么被折叠?



