我尝试设置 Gitolite mirroring concept除了子模块之外,一切都工作正常。
当我从从服务器克隆存储库(具有子模块)并更新子模块时,子模块将从主服务器克隆。
如何使这些子模块也从从服务器克隆?
最佳答案
一种方法是,例如在接收后 Hook 中,确保 .gitmodules
反射(reflect)了足够的子模块地址,通过 changing those submodules addresses ,后跟 git submodule sync
。
或者,请参阅“Git submodule url changed ”和新命令(Git 2.25+,2020 年第一季度)
git submodule set-url [--] <path> <newurl>
maxmelbin对象:
but changing
.gitmodules
means a new commit - right?
不一定:您可以进行该修改而不提交它,将其保持为纯粹的“私有(private)”(在您的从属服务器本地)。
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
我认为--reference
git submodule update
的参数命令可以实现这一点。
--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 thegit-clone
(1) command.
NOTE: Do not use this option unless you have read the note forgit-clone
's--reference
and--shared
options carefully.
关于子模块的 Gitolite 镜像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12067033/