Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
812 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 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#
See Question&Answers more detail:os

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

1 Reply

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...