mirror clone does not keep HEAD updated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,

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.

For example, here is what I did:

	$ git clone --mirror https://github.com/mvdan/test-repo
	$ cd test-repo
	$ git branch -a
	* main
	$ git log HEAD
	commit d1adda533e90692e02ae837233368fbcca2a0e49 (HEAD -> main)
	[...]

If I then go on the GitHub web UI to rename the default branch from
"main" to "newmain", `git remote update --prune` sees that:

	$ git remote update --prune
	From https://github.com/mvdan/test-repo
	 - [deleted]         (none)     -> main
	 * [new branch]      newmain   -> newmain

However, HEAD stops working:

	$ git log HEAD
	fatal: your current branch 'main' does not have any commits yet

Am I holding the mirror wrong somehow? As far as the manpages say, `git
remote update` should be enough to fully mirror all refs.
And my understanding is that using HEAD is correct, that I do not need
to use origin/HEAD like in a regular git clone.

I also tried what I would usually do to sync origin/HEAD in a regular
git clone, but unsurprisingly, that does not work:

	$ git remote set-head origin -a
	error: Not a valid ref: refs/remotes/origin/newmain

Any pointers appreciated. Assuming I'm not missing anything obvious
here, this might be a bug in `git remote udpate` for mirror clones.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux