0

我有一个远程存储库和一个本地存储库。我做了一个git fetch --all并在本地仓库中看到了我想要的分支,我想创建一个本地跟踪分支:

git checkout -t -b bug1000 origin/user/bug/1000

我的问题是 pull 是正确的,但 push 没有设置:

>$ 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 (截至写作时最新稳定)。

4

1 回答 1

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/*,从长远来看可能会更干净。

于 2012-05-21T18:05:42.537 回答