git 如何解决 GitHub 消息,指出我当前分支的尖端落后于其远程分支?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14827930/
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
How do I resolve a GitHub message that says the tip of my current branch is behind its remote counterpart?
提问by incandescentman
I am trying to learn how to use GitHub to version-control my work as I go. (I work alone, no collaborators, no different branches, just me backing up my work as I go.) I have set up private Git repositories at BitBucket.org. I am using GitHub for OSX as my Git GUI.
我正在尝试学习如何使用 GitHub 对我的工作进行版本控制。(我一个人工作,没有合作者,没有不同的分支,只有我在工作时备份我的工作。)我在 BitBucket.org 建立了私人 Git 存储库。我使用 GitHub for OSX 作为我的 Git GUI。
But when I make edits to the files in my local Git repository on my hard drive, then use GitHub for OSX to try to "Commit & Sync," I get this error:
但是,当我对硬盘驱动器上本地 Git 存储库中的文件进行编辑,然后使用 GitHub for OSX 尝试“提交和同步”时,出现此错误:
git: 'credential-osxkeychain' is not a git command. See 'git --help'.
git: 'credential-osxkeychain' is not a git command. See 'git --help'.
2013-02-12 02:49:07.409 GitHub for Mac Login[44516:707] AskPass with arguments: (
"/Applications/GitHub.app/Contents/MacOS/GitHub for Mac Login",
"Password for 'https://[email protected]': "
)
git: 'credential-osxkeychain' is not a git command. See 'git --help'.
git: 'credential-osxkeychain' is not a git command. See 'git --help'.
To https://[email protected]/username/data.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://[email protected]/username/data.git'
hint: Updates were rejected because the tip of your current branch is behind its remote counterpart. Merge the remote changes (e.g. 'git pull') before pushing again. See the 'Note about fast-forwards' in 'git push --help' for details.
(256)
(I edited the above to conceal my actual username.)
(我编辑了上面的内容以隐藏我的实际用户名。)
What does this mean, how do I resolve it, and how do I avoid getting it in the future?
这是什么意思,我如何解决它,以及如何避免将来得到它?
回答by ogzd
Someone (or you) have updated the remote branch. That causes your remote branch become ahead of your current branch. (that is your local branch)
有人(或您)更新了远程分支。这会导致您的远程分支领先于您的当前分支。(那是你当地的分行)
I suggest you to git pull --rebase origin master
and push
after that.
我建议你git pull --rebase origin master
和push
之后。