0

I have a remote repository and a local repo. I did a git fetch --all and see the branch I want in the local repo, I think create a local tracking branch:

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

My problem is the pull's are correct, but push's are not setup:

>$ 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)

My .git/config looks correct:

[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

I have already tried git push -u origin bug1000:user/bug/1000 but it doesn't change anything.

This is using git 1.7.10.2 (latest stable as of writing).

utopiabound
  • 268
  • 1
  • 6

1 Answers1

0

You can add a push entry for that remote, but if you have a lot of these, that might get cumbersome:

[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = XXX
    push = refs/heads/bug1000:refs/heads/user/bug/1000

If you added another virtual "directory" and used bug/1000 locally instead of bug1000, then the push config could be push = refs/heads/bug/*:refs/heads/user/bug/*, which might be cleaner in the long run.

twalberg
  • 59,951
  • 11
  • 89
  • 84
  • I looked at adding the push line, but there are actually a lot of branches to track. Adding the push line then makes me unable to push to master simply... – utopiabound May 22 '12 at 15:52
  • 1
    Note you can add multiple push lines, so you could have the default one that matches "normal" branches, and the special-case one(s) to handle bug branches. – twalberg May 22 '12 at 16:36