Error creating branch: "warning: refname" master "is ambiguous."

I had a simple project managed in a Git repository. To date, I have not intentionally created any branches, but when I tried to create my first one 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 it ok to see in Git? Am I cloning my repository incorrectly? What is the best way to solve this problem?

+7
git git-branch
Mar 12 2018-11-11T00:
source share
2 answers

This seems to be ambiguous because your name and the branch name is master . You can try renaming the remote to a more ordinary origin by running

 git remote rename master origin 
+11
Mar 12 2018-11-11T00:
source share

Rules for interpreting specification specifications are given in gitrevisions (7) (link to git (1) , among other bits of the documentation).

In short, master matches two patterns when applied to refs in your repository: the local branch ( refs/heads/<name> ) and the remote remote tracking branch ( refs/remotes/<name>/HEAD ) by default.

They can be eliminated with heads/master for the local branch and master/HEAD (or master/master in your case) for the remote tracking branch.

As stated in Andrew Marshall , you can rename your remote control to avoid the need for disambiguation.

+6
Mar 12 '11 at 3:22
source share



All Articles