Git的.远程HEAD不明确

zs2*_*020 25 git

我检查了相关的线程,但仍然无法弄清楚幕后发生了什么.

当我输入时git remote show origin,我得到了:

* 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)
Run Code Online (Sandbox Code Playgroud)

我也查了一下git show-ref,得到了:

3f8f4292e31cb8fa5938dbdd406b2f357764205b refs/heads/development
3f8f4292e31cb8fa5938dbdd406b2f357764205b refs/heads/master
3f8f4292e31cb8fa5938dbdd406b2f357764205b refs/remotes/origin/development
3f8f4292e31cb8fa5938dbdd406b2f357764205b refs/remotes/origin/master
Run Code Online (Sandbox Code Playgroud)

这是我执行的所有分支的列表git branch -a:

  development
* master
  remotes/origin/development
  remotes/origin/master
Run Code Online (Sandbox Code Playgroud)

这就是.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
Run Code Online (Sandbox Code Playgroud)

似乎远程开发和主分支共享同一节点.如何解决这种歧义问题?

num*_*er5 41

您的远程回购没有任何问题.git告诉你"远程HEAD是模糊的",因为master和development都有相同的SHA1哈希.如果你只是从master开始分支开发,那应该是这样的.

尝试提交一些东西来掌握或开发并将其推向原点; "模糊"消息将消失,而您刚刚提交的任何分支将成为远程HEAD分支.