如何在gitHub上将现有的本地分支推送到远程?

时间:2013-10-24 12:28:58

标签: eclipse git version-control github

我正在使用sourceTree。

如何将现有本地项目(分支)推送到

我赢得了一个远程Gitbug存储库吗?

我尝试收到此错误:

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags --set-upstream memPic master:master 
Pushing to https://github.com/elad2109/memPic.git
To https://github.com/elad2109/memPic.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/elad2109/memPic.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Completed with errors, see above

但无论如何我不确定所需的步骤是什么?

2 个答案:

答案 0 :(得分:2)

这不是github问题,而是git问题。如果没有合并/变基,则无法进行非快进。请检查文档的相应部分。

This网站对于理解问题非常有帮助!

所以你基本上要么git pullgit pull --rebase

答案 1 :(得分:0)

这是失败的,因为你的分支的尖端在它的遥控器后面。如果没有rebase的提取,可能会发生这种情况。

有两种方法可以修复。要保持远程更改,请在命令之前添加git rebase。要放弃其他更改(不推荐),请在推送命令中添加-f

相关问题