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/r
Got it! The problem was that I have previously set up a remote with --mirror, for the purpose of having a backup / public copy of my repository.
If you run
git remote add --mirror
it does not only flag the remote as mirror (which is what I wanted for pushes), but also configures remote. option for the mirror to +refs/*:refs/*, which means that all of your branches suddenly "track" your mirror repository and any attempt to create a tracking branch is going to fail.
(As an added bonus, running git fetch is going to overwrite all your refs with old ones from your backup repo.)
The solution that seems to fix this issue is setting remote. to : (which, I hope, means "never fetch anything"). This apparently fixes the tracking issue and eliminates the deadly fetch.