多个git子模块url - 每个远程子模块 [英] Multiple urls of git submodule - per remote submodules
问题描述
我有两个远程git仓库(github和bitbucket)。里面我有submodule,这相应地指向另一个github / bitbucket回购。
但是子模块的定义是url,它是硬编码的。我可以有两个吗?或者每个遥控器一个?所以我的主要回购github指向github上的子模块。我在Bitbucket的主要回购指向bitbucket上的子模块?
$ b $ pre $ $ $ $子模块程序/ mgr-nancy-demo
path = programs / mgr-nancy-demo
url = git@github.com:wedkarz / mgr-nancy-demo.git
您似乎可以使用相对URL子模块的。从> git help submodules
:
命令
add
[/ b]
< repository>
是新子模块的源存储库的URL。这可能是绝对URL或(如果它以./或../开头),相对于超级项目的原始存储库的位置
因此,如果您在两个站点中都遵循相同的命名约定(即 github.com/you/parent-project
, bitbucket.org / you / parent-project
, github.com/you/child-project
和 bitbucket.org/you/child -project
),你应该可以像这样设置子模块:
[子模块]程序/ mgr-nancy-demo]
path = programs / mgr-nancy-demo
url = ../mgr-nancy-demo.git
测试它 - YMMV!
I have git repository with two remotes (github and bitbucket). Inside I have submodule, that points accordingly to another github/bitbucket repo. But in the definition of submodule is url, that is hardcoded. Can I have two of them? Or one per remote? So that my main repo on github points to submodule on github. And my main repo on Bitbucket points to submodule on bitbucket?
[submodule "programs/mgr-nancy-demo"]
path = programs/mgr-nancy-demo
url = git@github.com:wedkarz/mgr-nancy-demo.git
It seems you can use relative URLs for submodules. From git help submodules
:
COMMANDS
add
[...]
<repository>
is the URL of the new submodule’s origin repository. This may be either an absolute URL, or (if it begins with ./ or ../), the location relative to the superproject’s origin repository
So, if you follow the same naming convention in both sites (ie, github.com/you/parent-project
, bitbucket.org/you/parent-project
, github.com/you/child-project
and bitbucket.org/you/child-project
), you should be able to set the submodule like this:
[submodule "programs/mgr-nancy-demo"]
path = programs/mgr-nancy-demo
url = ../mgr-nancy-demo.git
Test it - YMMV!
这篇关于多个git子模块url - 每个远程子模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!