Git Error: warning: refname 'origin/branch-name' is ambiguous.

Post by on October 3, 2012

Have you ever had this error?

$ git co -t origin/branch-name
warning: refname 'origin/branch-name' is ambiguous.
warning: refname 'origin/branch-name' is ambiguous.
fatal: Ambiguous object name: 'origin/branch-name'.

Well, as it turns out the issue was caused by a typo when I first attempted to check out the "branch-name" branch:

$ git co -b origin/branch-name

When this happened, it created the file .git/refs/heads/origin/branch-name. So, I just deleted the file:

$ rm .git/refs/heads/origin/branch-name

Then, attempted to check out the branch again:

$ git co -t origin/branch-name
Branch branch-name set up to track remote branch branch-name from origin.
Switched to a new branch 'branch-name'

And it works! Hopefully, this helps someone (or even me if I forget)!

Older Posts »