我有一个远程存储库和一个本地存储库。我做了一个git fetch --all
并在本地仓库中看到了我想要的分支,我想创建一个本地跟踪分支:
git checkout -t -b bug1000 origin/user/bug/1000
我的问题是拉力是正确的,但是没有设置推送:
>$ git remote show origin
* remote origin
Fetch URL: XXX
Push URL: XXX
HEAD branch: master
Remote branches:
maint tracked
master tracked
user/bug/1000 tracked
user/bug/1001 tracked
user/bug/1002 tracked
Local branches configured for 'git pull':
bug1000 merges with remote user/bug/1000
maint merges with remote maint
master merges with remote master
Local refs configured for 'git push':
maint pushes to maint (local out of date)
master pushes to master (local out of date)
我的.git/config
看起来是正确的:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = XXX
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "maint"]
remote = origin
merge = refs/heads/maint
[branch "bug1000"]
remote = origin
merge = refs/heads/user/bug/1000
我已经尝试了git push -u origin bug1000:user/bug/1000
,但它没有改变任何内容。
这是使用git 1.7.10.2(写作时最新的稳定版)。
答案 0 :(得分:0)
您可以为该遥控器添加push
条目,但如果您有很多这样的条目,那可能会很麻烦:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = XXX
push = refs/heads/bug1000:refs/heads/user/bug/1000
如果您添加了另一个虚拟“目录”并在本地使用bug/1000
而不是bug1000
,那么推送配置可能是push = refs/heads/bug/*:refs/heads/user/bug/*
,从长远来看可能更干净。