Skip to content

Make sure the cloned repo's remote is named origin

Matthias Kurz requested to merge mkurz/pacman:git-clone-set-remote into master

In the modified script you can see pacman relies on the remote to be named origin. Since git v2.30.0 however it's possible to set the global config "clone.defaultRemoteName" to a custom remote name. Obviously, doing so will break pacman. That's why we need to make sure git clone always sets the remote name to origin.

-c clone.defaultRemoteName=... is available since git v2.30.0 (28th Dec 2020)

You might think why use -c clone.defaultRemoteName=... and not -o ...? That's because -o is not allowed together with --bare (which is implied when using --mirror). This is strange and makes no sense, that's why upcoming (not yet released) git v2.38.2 will lift this restriction:

To not wait for that git v2.38.2 release and until people upgraded to it, I think it's reasonable to just use the -c ... config for now, it's equivalent anyway and setting it on the command line will overrule any global settings (precedence are listed in the git message here)

I would love to see that fix also backported to the 6.0.x branch, would that be possible?

Thank you very much!

Merge request reports