Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
813 views
in Technique[技术] by (71.8m points)

github - Git non-fast-forward updates were rejected Merge the remote changes

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

git push origin monty_svm_dev

To [email protected]:  ! [rejected]        monty_svm_dev -> monty_svm_dev
(non-fast-forward) error: failed to push some refs to
'[email protected]:/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#
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...