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

I saw this also when I had two remote repo’s with the same (default) fetch pattern (fetch = +refs/heads/*:refs/remotes/origin/*) and the same branches.

The original mistake was in creating two remotes with the same fetch configuration. The new remote has a different name, and therefore the name of its folder should have been changed as well. Here is an example of a proper multiple-remote configuration:

[remote "origin"]
    url = <primary-source>
    fetch = +refs/heads/*:refs/remotes/origin/*
[remote "alt"]
    url = <alternate-source>
    fetch = +refs/heads/*:refs/remotes/alt/*

In place of alt put any name of your choosing.

Explanation:

The meaning of refs/heads/*:refs/remotes/origin/* is: take all the remote reference in refs/heads on the remote side, and put the to refs/heads/origin on our side. refs/heads is the path where branches are stored, so if you have branch foo on the remote, it will be fetched to origin/foo in your local repo. The + on the beginning means that the destination branches should be always overwritten (w/o that there are some additional checks).

Alternatively:

You can also manually add the info to the project’s .git/config, e.g.:

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

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)