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

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

问题描述

我该如何解决这个问题?我正在尝试提交,但出现以下错误.

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

git push origin monty_svm_dev

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

发生的事情是远程的更改比您的分支更新的要多.

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.

您可以通过执行 git checkout your_branch 来执行此操作,然后:

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

git fetch origin your_branch 然后一个
git merge your_branch

git pull origin your_branch # fetch and merge in one operation

你的分支是 master 的地方,或者你的分支名称(我认为在你的情况下似乎是 monty_svm_dev)

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

一旦完成(并解决任何冲突),您可以执行 git push origin monty_svm_dev

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

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

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