Error with git: remote HEAD is ambiguous, may be one of the following
After branching and pushing to the remote, a git remote show origin
gives the report
HEAD branch (remote HEAD is ambiguous, may be one of the following):
master
otherbranch
What does the imply?
It is a critical error?
remote origin
Fetch URL: gituser@local.repos.cc:/home/gituser/repos/csfsconf.git
Push URL: gituser@开发者_开发技巧local.repos.cc:/home/gituser/repos/csfsconf.git
HEAD branch (remote HEAD is ambiguous, may be one of the following):
master
otherbranch
You can see the same warning in this blog post
(master)jj@im-jj:~/demo$ git checkout -b rc-1.0
Switched to a new branch 'rc-1.0'
(rc-1.0)jj@im-jj:~/demo$ git push origin rc-1.0
Total 0 (delta 0), reused 0 (delta 0)
To my-server:/git/demo.git
* [new branch] rc-1.0 -> rc-1.0
(rc-1.0)jj@im-jj:~/demo$ git remote show origin
* remote origin
URL: my-server:/git/demo.git
HEAD branch (remote HEAD is ambiguous, may be one of the following):
master
rc-1.0
Remote branches:
master tracked
rc-1.0 tracked
Local branch configured for 'git pull':
master merges with remote master
Local refs configured for 'git push':
master pushes to master (up to date)
rc-1.0 pushes to rc-1.0 (up to date)
That (pushing a new current branch) will introduce a new HEAD reference to the remote repo.
If you look at the Git sources for this warning message, it tries to get the remote HEAD names through get_head_names()
which calls :
matches = guess_remote_head(find_ref_by_name(remote_refs, "HEAD"),
+ fetch_map, 1);
As described in this patch:
Determining HEAD is ambiguous since it is done by comparing SHA1s.
(see the code here)
In the case of multiple matches we return refs/heads/master if it matches, else we return the first match we encounter.
builtin-remote
needs all matches returned to it, so add a flag for it to request such.
The thread at http://forums.wf.klevo.sk/comments.php?DiscussionID=155 has a discussion of this topic. In particular the thread mentions:
# make a new branch where you can make and commit changes to
$git checkout -b darth-kool
Switched to a new branch 'darth-kool'
# * marks current branch
$git branch -l
* darth-kool
master
Perhaps you need to mark your current branch? If not, the rest of the thread may help.
精彩评论