Git非快进更新被拒绝合并远程更改 [英] Git non-fast-forward updates were rejected Merge the remote changes

查看:753
本文介绍了Git非快进更新被拒绝合并远程更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何解决这个问题?我试图提交,但我得到了下面的错误。



git push origin monty_svm_dev

 至git@github.com:! [rejected] monty_svm_dev  - > monty_svm_dev 
(非快进)错误:无法将某些参考文献推送到
'git@github.com:/mygit.git'为了防止您丢失历史记录,
非快速-forward更新被拒绝合并
再次推送前的远程更改。有关详细信息,请参阅'git
push --help'中的'关于快进的提示'部分。 root @ li409-202:〜/ mypath#


解决方案

git pull origin monty_svm_dev 第一个



发生了什么事情是遥控器比你的分支有更新的变化。



因此,在您的 push 您的更改之前,您需要首先获取并合并远程更改。 / p>

您可以通过执行 git checkout your_branch 来做到这一点,然后:



git fetch origin your_branch 然后一个

git merge your_branch



  git pull origin your_branch#在一次操作中获取并合并

您的分支是主人,还是您的分支名称(似乎是 monty_svm_dev 在你的情况下,我认为)



完成此操作并解决任何冲突后,可以执行 git push origin monty_svm_dev


How do I resolve this issue? I am trying to commit but I get the below error.

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#

解决方案

do git pull origin monty_svm_dev first

What has happened is that the remote has more recent changes than your branch.

So before you can push your changes, you need to get and merge the changes on the remote first.

You can do this either by doing a git checkout your_branch, then:

git fetch origin your_branch and then a
git merge your_branch

or

git pull origin your_branch # fetch and merge in one operation

Where your branch is master, or your branch name (seems to be monty_svm_dev in your case I think)

Once this is done (and any conflicts resolved) you can do a git push origin monty_svm_dev

这篇关于Git非快进更新被拒绝合并远程更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆