分支并推送到遥控器后,git remote show origin
会提供报告
HEAD branch (remote HEAD is ambiguous, may be one of the following):
master
otherbranch
这意味着什么?
这是一个严重的错误?
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
答案 0 :(得分:2)
您可以在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)
那个(推送一个新的当前分支)将引入一个新的HEAD引用到远程仓库。
如果查看Git sources for this warning message,它会尝试通过get_head_names()
调用远程HEAD名称:
matches = guess_remote_head(find_ref_by_name(remote_refs, "HEAD"),
+ fetch_map, 1);
如this patch中所述:
确定HEAD是不明确的,因为它是通过比较SHA1来完成的。
(参见code here)
在多个匹配的情况下,如果匹配则返回refs / heads / master,否则我们返回我们遇到的第一个匹配。
builtin-remote
需要返回给它的所有匹配项,因此请为其添加一个标记来请求。
答案 1 :(得分:0)
http://forums.wf.klevo.sk/comments.php?DiscussionID=155的主题讨论了这个主题。特别是线程提到:
# 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
也许您需要标记当前的分支?如果没有,线程的其余部分可能会有所帮助。