git 无法向 github 提交更改
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5914343/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't commit changes to github
提问by Antarr Byrd
Whenever I try and to commit changes to my github repo I get this error.
每当我尝试向我的 github 存储库提交更改时,我都会收到此错误。
To [email protected]:antarr/3skeleton.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:antarr/3skeleton.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.
See the 'Note about fast-forwards' section of 'git push --help' for details.
到 [email protected]:antarr/3skeleton.git
![rejected] master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:antarr/3skeleton.git'
为了防止你丢失历史,非快进更新被拒绝
在再次推送之前合并远程更改(例如“git pull”)。
有关详细信息,请参阅“git push --help”的“关于快进的注意事项”部分。
If I do git pull
first, it changes some of the files on my machine. Which kind of defeats the purpose.
如果我git pull
先这样做,它会更改我机器上的一些文件。哪一种违背了目的。
回答by Rex Morgan
It sounds like files have been committed and pushed to the repository on github since you last updated.
听起来自您上次更新以来,文件已提交并推送到 github 上的存储库。
doing a git pull
will pull those changes down and merge them in with your changes. You can then test everything and make sure it still works, and then do a push.
做一个git pull
将拉下这些更改并将它们与您的更改合并。然后您可以测试所有内容并确保它仍然有效,然后进行推送。
It should not overwrite the changes that you have made and are trying to commit.
它不应该覆盖您所做的和尝试提交的更改。