如何解决这个问题?我正在尝试提交,但出现以下错误。
git push origin monty_svm_dev
To git@github.com: ! [rejected] monty_svm_dev -> monty_svm_dev
(non-fast-forward) error: failed to push some refs to
'git@github.com:/mygit.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. root@li409-202:~/mypath#
最佳答案
先做 git pull origin monty_svm_dev
发生的事情是远程的更改比您的分支更新。
因此,在您可以推送
您的更改之前,您需要先获取并 merge 远程上的更改。
您可以通过执行 git checkout your_branch
来完成此操作,然后:
git fetch origin your_branch
然后是
git merge your_branch
或
git pull origin your_branch # fetch and merge in one operation
你的分支是 master,或者你的分支名称(我认为在你的情况下似乎是 monty_svm_dev
)
完成此操作(并解决所有冲突)后,您可以执行 git push origin monty_svm_dev
关于Git 非快进更新被拒绝 merge 远程更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12236854/