I got this error when starting up TortoiseGit:

Could not get all refs.
libgit2 returned: Refspec 'refs/heads/origin/HEAD' not found
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?
Updated Answer
So it turns out that, for the purpose of updating a local repo's view of which branch
<remote>/HEADpoints 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 withgit symbolic-reflike in my old solution below: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
git symbolic-refdirectly on the remote repo, if you have access to it.git remote set-head.Old Answer
The problem that the error message refers to is that apparently libgit2 is trying to read the remote default branch pointed to by
refs/remotes/origin/HEAD, but the remote branch doesn't exist, thus the error.Using
git branch -a, my local repo thinks thatorigin/developis the remote default branch:At one point
origin/developwas indeed the default branch in myoriginrepo on GitHub, but it isn't any longer, themasterbranch is. Thedevelopbranch was deleted fromoriginsince it was no longer needed.So I fixed this by manually updating the local reference
origin/HEADto point to the new default branch onorigin:Or if I wanted to also add a message to the reflog for
refs/remotes/origin/HEAD:This resolved the issue. See also:
git symbolic-ref.