Why does git branch -t fail with "Not tracking: ambiguous information"?

Viewed 14436

When I try to create a new branch tracking a remote branch, I get this:

$ git branch -t test origin/foo
error: Not tracking: ambiguous information for ref refs/remotes/origin/foo

The source seems to somehow search for branches to track and throws me out because it finds less more than one, but I don't exactly get what it's looking for since I already told it what to track on the command line.

Can anybody tell me what's going on and how to fix it?

5 Answers

None of the other fixes mentioned here worked for me. The one that ended up working was this:

$ git branch -t test origin/test
error: Not tracking: ambiguous information for ref refs/remotes/origin/test

After running the above, even though git complained, it did end up creating a local branch test but no upstream set.

Now, I opened the .git/config file (which did not have any record of a branch test) and added the following manually:

[branch "test"]
        remote = origin
        merge = refs/heads/test

After which everything worked fine.

Related