One way would be, for instance in a post-receive hook, to make sure the .gitmodules
reflects the adequate submodules addresses, by changing those submodules addresses, followed by a git submodule sync
.
Or, See "Git submodule url changed" and the new command (Git 2.25+, Q1 2020)
git submodule set-url [--] <path> <newurl>
maxmelbin objects:
but changing .gitmodules
means a new commit - right?
Not necessarily: you could make that modification and not commit it, keeping it purely "private" (local to your slave server).
Question was that since all repo's are mirrored in the slave, is there a way to automatically pick the local repo url during a submodule update, regardless of which sites url was configured in .gitmodules for that commit has
I think the --reference
parameter of the git submodule update
command could achieve just that.
--reference <repository>
This option is only valid for add and update commands.
These commands sometimes need to clone a remote repository. In this case, this option will be passed to the git-clone
(1) command.
NOTE: Do not use this option unless you have read the note for git-clone
's --reference
and --shared
options carefully.