错误与git:remote HEAD不明确,可能是下列之一 [英] Error with git: remote HEAD is ambiguous, may be one of the following

查看:600
本文介绍了错误与git:remote HEAD不明确,可能是下列之一的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

分支并推送到远程后, git远程显示源给出报告

  HEAD分支(远程HEAD不明确,可能是以下之一):
master
otherbranch

暗示什么?



这是一个严重的错误?

 远程原点
抓取网址:gituser@local.repos.cc:/home/gituser/repos/csfsconf.git
推送网址:gituser@local.repos.cc:/home/gituser/repos/csfsconf.git
HEAD分支(远程HEAD不明确,可能是下列之一):
master
otherbranch


解决方案

您可以在,它试图通过 get_head_names()获取远程HEAD名称,该名称称为:

  matches = guess_remote_head(find_ref_by_name(remote_refs,HEAD),
+ fetch_map,1);

此修补程序


确定HEAD是不明确的,因为它是通过比较SHA1来完成的。

(请参阅 code here


如果是多场比赛,我们会返回refs / heads / master,否则我们会返回我们遇到的第一场比赛。 builtin-remote 需要将所有匹配返回给它,因此请添加一个标志来请求它。


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.

这篇关于错误与git:remote HEAD不明确,可能是下列之一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆