Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error on branch creation: "warning: refname 'master' is ambiguous."

Tags:

git

git-branch

I've had simple project being managed in a Git repository. To date I haven't intentionally created any branches, but when I tried to create my first today using

$ git branch mybranch

I see this error:

warning: refname 'master' is ambiguous.
fatal: Ambiguous object name: 'master'.

Digging deeper:

$ git branch -a          
* master
remotes/master/HEAD -> master/master
remotes/master/master

Is this normal to see in Git? Have I cloned my repository incorrectly? What is the best way to resolve this problem?

like image 589
Andrew J Avatar asked Mar 12 '11 01:03

Andrew J


1 Answers

It seems it's ambiguous because your remote name and branch name are both master. You can try renaming the remote to the more conventional origin by running

git remote rename master origin
like image 139
Andrew Marshall Avatar answered Oct 05 '22 15:10

Andrew Marshall