我有一个本地Git仓库,有两个远程仓库。
然而,
有什么想法吗?
origin
是 upstream
的一个分支。我在 master
上工作。 我希望实现以下目标:
git pull
相当于git pull upstream master
git push
相当于git push origin master
git pull origin master
从origin
拉代码git push upstream master
推到upstream
因此,将 origin
与 upstream
同步的工作流将简化为:
git pull # from upstream
git push # to origin
我已经通过一系列git config
命令成功配置了第一部分,以下是结果:
[branch "master"]
remote = upstream
merge = refs/heads/master
pushRemote = origin
然而,
git push
给我返回了以下错误信息:fatal: You are pushing to remote 'origin', which is not the upstream of
your current branch 'master', without telling me what to push
to update which remote branch.
有什么想法吗?
push.default
设置?在Git >= 2.0中,这应该可以工作,除非你配置了其他的push.default
设置。 - toreksimple
。然而,在明确指定push.default = simple
后,我的问题得到了解决。感谢您的回复。 - iBugpush.default
就可以工作。我会将其发布为答案。 - torek