libgit2返回:在TortoiseGit中找不到refspec'refs / heads / origin / HEAD'错误 [英] libgit2 returned: Refspec 'refs/heads/origin/HEAD' not found error in TortoiseGit
问题描述
我在启动TortoiseGit时遇到这个错误:
无法获取所有文件
libgit2文件返回:Refspec'refs / heads /原产地/ HEAD'找不到
虽然令人讨厌,但它并不妨碍我使用TortoiseGit。不过,我想让它消失,因为它很好,烦人。如何解决这个问题? 事实证明,为了更新分支< remote> / HEAD
点的 本地回购视图到,你可以让git自动从远程获取这些信息并在本地为你设置,而不是像我的旧解决方案那样用 git symbolic-ref
手动设置它。上面:
git remote set-head< remote> --auto
#或更短
git远程设置头<远程> -a
请注意,此命令 实际上并未更改默认分支是在远程回购本身 。为此,您可能需要如果您有权访问它,请直接在远程仓库上使用 git symbolic-ref
。
旧回覆
错误消息引用的问题是显然libgit2正在尝试读取由 refs / remotes / origin / HEAD
指向的远程默认分支,但远程分支不会'
$ b
使用 git branch -a
,我的本地仓库认为 origin / develop
是远程默认分支:
遥控器/ origin / HEAD - > ; origin / develop
一点 origin
repo中的默认分支,但它已经不再是了, master
分支是。 开发
分支已从 origin
中删除,因为它已不再需要。
所以我通过手动更新本地引用 或者,如果我还想为 这解决了这个问题。另见: I got this error when starting up TortoiseGit: Could not get all refs. While annoying, it does not prevent me from using TortoiseGit. However, I'd like to make it go away, because it is, well, annoying. How do I fix this? So it turns out that, for the purpose of updating a local repo's view of which branch Note that this command doesn't actually change what the default branch is on the remote repo itself. For that, you'll probably need to use The problem that the error message refers to is that apparently libgit2 is trying to read the remote default branch pointed to by Using At one point So I fixed this by manually updating the local reference Or if I wanted to also add a message to the reflog for This resolved the issue. See also:
这篇关于libgit2返回:在TortoiseGit中找不到refspec'refs / heads / origin / HEAD'错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! origin / HEAD
指向 origin $ c上的新默认分支来解决此问题
$ b $ pre $ git symbolic-ref refs / remotes / origin / HEAD refs / remotes / origin / master
refs / remotes / origin / HEAD
: git symbolic-ref -mUpdate to new远程默认分支\
refs / remotes / origin / HEAD refs / remotes / origin / master
libgit2 returned: Refspec 'refs/heads/origin/HEAD' not foundUpdated Answer
<remote>/HEAD
points to, you can have git automatically fetch that information from the remote and set it locally for you, instead of having to manually set it with git symbolic-ref
like in my old solution above:git remote set-head <remote> --auto
# Or shorter
git remote set-head <remote> -a
git symbolic-ref
directly on the remote repo, if you have access to it.Old Answer
refs/remotes/origin/HEAD
, but the remote branch doesn't exist, thus the error.git branch -a
, my local repo thinks that origin/develop
is the remote default branch:remotes/origin/HEAD -> origin/develop
origin/develop
was indeed the default branch in my origin
repo on GitHub, but it isn't any longer, the master
branch is. The develop
branch was deleted from origin
since it was no longer needed.origin/HEAD
to point to the new default branch on origin
:git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/master
refs/remotes/origin/HEAD
:git symbolic-ref -m "Update to new remote default branch" \
refs/remotes/origin/HEAD refs/remotes/origin/master
git symbolic-ref
.