如何让git默认推送到当前远程?
我有一个存储库,其中一些分支位于公共远程,其他分支位于私有远程:
origin [email protected]:name/project (fetch)
origin [email protected]:name/project (push)
private [email protected]:name/project-private (fetch)
private [email protected]:name/project-private (push)
因此,例如分支“some-public-feature”将位于“origin”远程,而“some-private-功能”将位于“私人”遥控器上。
这工作正常并且内容被推送到正确的存储库。但是,当我尝试从私有分支推送时,它总是显示此消息:
fatal: The upstream branch of your current branch does not match
the name of your current branch. To push to the upstream branch
on the remote, use
git push private HEAD:some-private-feature
To push to the branch of the same name on the remote, use
git push private HEAD
所以我真的需要输入 git push private HEAD ,它工作正常,但我想知道是否有任何方法可以使git 默认这样做吗?换句话说,“git push”应该始终将当前分支推送到远程上的同名分支。知道是否可以做到吗?
(请注意,我对于公共分支没有这个问题 - 在这种情况下,简单的“git Push”可以按预期工作,所以我不确定有什么不同)
I've got a repository where some branches are on a public remote, and others on a private remote:
origin [email protected]:name/project (fetch)
origin [email protected]:name/project (push)
private [email protected]:name/project-private (fetch)
private [email protected]:name/project-private (push)
So for example a branch "some-public-feature", will be on the "origin" remote, while "some-private-feature" will be on the "private" remote.
This works fine and things get pushed to the correct repositories. However when I try to push from the private branch, it always displays this message:
fatal: The upstream branch of your current branch does not match
the name of your current branch. To push to the upstream branch
on the remote, use
git push private HEAD:some-private-feature
To push to the branch of the same name on the remote, use
git push private HEAD
So really I need to type git push private HEAD
, which works fine, but I'm wondering if there's any way to make git do this by default? In other words, "git push" should always push the current branch to the branch of the same name on the remote. Any idea if that can be done?
(Note that I don't have this problem for the public branches - in that case, a simple "git push" works as expected, so I'm not sure what's different)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论