Multiple urls of git submodule - per remote submodules

扶醉桌前 提交于 2019-12-03 23:25:43

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!

What if it's not all "you" in the paths. For example:

github.com/you/parent-project, bitbucket.org/you/parent-project, github.com/you/child-project, bitbucket.org/other/child-project

I have access to bitbucket.org/other/child-project but not its owner.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!