Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git. Remote HEAD is ambiguous

Tags:

git

I checked the relevant threads but still can't figure out what is going on behind the scenes.

When I typed git remote show origin, I got:

* remote origin   Fetch URL: xxxx   Push  URL: xxxx   HEAD branch (remote HEAD is ambiguous, may be one of the following):     development     master   Remote branches:     development tracked     master      tracked   Local branches configured for 'git pull':     development merges with remote development     master      merges with remote master   Local ref configured for 'git push':     master pushes to master (up to date) 

I also checked git show-ref, and I got:

3f8f4292e31cb8fa5938dbdd406b2f357764205b refs/heads/development 3f8f4292e31cb8fa5938dbdd406b2f357764205b refs/heads/master 3f8f4292e31cb8fa5938dbdd406b2f357764205b refs/remotes/origin/development 3f8f4292e31cb8fa5938dbdd406b2f357764205b refs/remotes/origin/master 

Here is the list of all branches I have by executing git branch -a:

  development * master   remotes/origin/development   remotes/origin/master 

And this is what is in the .git/config:

[core]     repositoryformatversion = 0     filemode = false     bare = false     logallrefupdates = true     ignorecase = true     hideDotFiles = dotGitOnly     autocrlf = false [remote "origin"]     fetch = +refs/heads/*:refs/remotes/origin/*     url = xxxx     push = refs/heads/master:refs/heads/master [branch "master"]     remote = origin     merge = refs/heads/master [branch "development"]     remote = origin     merge = refs/heads/development 

It seems that the remote development and master branch share the same node. How do I solve this ambiguity problem?

like image 642
zs2020 Avatar asked May 14 '10 06:05

zs2020


1 Answers

There is nothing wrong with your remote repos. git tells you "remote HEAD is ambiguous" because master and development both have same SHA1 hash. If you've just branched development out from master, that's how it should be.

Try to commit something to master or development and push it to origin; that "ambiguous" message will be gone, and whichever branch you just committed to will become the remote HEAD branch.

like image 89
number5 Avatar answered Sep 24 '22 14:09

number5