I have a repo which tracks non-default branches. So, there is a local branch named "master" which should track "origin/master-13.07". I've done "push -u", and I believe it should be enough, the branch is tracked. Output of the git branch -vv
:
我有一个跟踪非默认分支的仓库。因此,有一个名为“master”的本地分支应该跟踪“origin / master-13.07”。我已经完成了“push -u”,我相信它应该足够了,跟踪分支。输出git branch -vv:
C:\work\repo>git branch -vv
stuff 68792df [origin/stuff-13.07] Small bugfix
* master 68792df [origin/master-13.07: ahead 1] Small bugfix
Output of the git status
输出git状态
C:\work\repo>git status
# On branch master
# Your branch is ahead of 'origin/master-13.07' by 1 commit.
# (use "git push" to publish your local commits)
#
nothing to commit, working directory clean
All seems all right, but when I just use "git push" (as git recommends me above), it fails:
一切似乎都没问题,但是当我只使用“git push”(正如git推荐我上面)时,它失败了:
C:\work\repo>git push
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 origin HEAD:master-13.07
To push to the branch of the same name on the remote, use
git push origin master
Yes, I know that the name doesn't match, this is exactly what I want and I told so to git by "push -u". Why I cannot just use "push"?
是的,我知道这个名字不匹配,这正是我想要的,我告诉他们通过“push -u”来git。为什么我不能只使用“推”?
C:\work\repo>git --version
git version 1.8.3.msysgit.0
C:\work\repo>git config push.default
simple
1 个解决方案
#1
17
Ok. With the informations you added, I think you simply have to change push.default
to value upstream
.
好。根据您添加的信息,我认为您只需将push.default更改为上游值。
You probably configured the actual value after upgrading Git and seeing this message :
您可能在升级Git并看到此消息后配置了实际值:
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
According to the documentation, value simple
must reject a push when branch names are different. See Git Config (search for push.default
).
根据文档,当分支名称不同时,value simple必须拒绝推送。请参阅Git Config(搜索push.default)。
#1
17
Ok. With the informations you added, I think you simply have to change push.default
to value upstream
.
好。根据您添加的信息,我认为您只需将push.default更改为上游值。
You probably configured the actual value after upgrading Git and seeing this message :
您可能在升级Git并看到此消息后配置了实际值:
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
According to the documentation, value simple
must reject a push when branch names are different. See Git Config (search for push.default
).
根据文档,当分支名称不同时,value simple必须拒绝推送。请参阅Git Config(搜索push.default)。