On Tue, Apr 4, 2023 at 11:35 AM Daniel Martí <mvdan@xxxxxxxx> wrote: > > I'm testing `git clone --mirror` to properly mirror a repository on > github.com. It appears to be working well, except for keeping HEAD > correctly in place. Git does not set or update the remote HEAD, that's something the user is supposed to do (for some reason). The only exception is when cloning a repository. In my opinion this is completely unintuitive and unhelpful. 99.99% of the time I want the remote HEAD to be pointing to where the remote's HEAD is pointing to. I implemented patches to fix that [1], but they were never merged. It's particularly wrong when you are mirroring a repository, as in your case. > Am I holding the mirror wrong somehow? As far as the manpages say, `git > remote update` should be enough to fully mirror all refs. That's what I would expect, but that's not true. I find that most of the time I need to read git's code to actually understand what it's supposed to do. I don't bother reading the documentation. I've updated my old RFC patch adding tests and an option to make it work with mirrored repositories as well. With `fetch.updateHead=always` the mirrored clone always has the HEAD up-to-date. Cheers. [1] https://lore.kernel.org/git/20201118091219.3341585-1-felipe.contreras@xxxxxxxxx/ [2] https://lore.kernel.org/git/20230405012742.2452208-1-felipe.contreras@xxxxxxxxx/T/#ma012c4823814936a3ab8755d1d2b805d61b43133 -- Felipe Contreras