gpt4 book ai didi

git - git 子模块的多个 url - 每个远程子模块

转载 作者:IT王子 更新时间:2023-10-29 01:30:30 24 4
gpt4 key购买 nike

我有一个带有两个 Remote (github 和 bitbucket)的 g​​it 仓库。我里面有子模块,相应地指向另一个 github/bitbucket 存储库。但是在子模块的定义中是url,这是硬编码的。我可以要两个吗?还是每个 Remote 一个?这样我在 github 上的主要 repo 指向 github 上的子模块。我在 Bitbucket 上的主要 repo 指向 bitbucket 上的子模块?

[submodule "programs/mgr-nancy-demo"]
path = programs/mgr-nancy-demo
url = git@github.com:wedkarz/mgr-nancy-demo.git

最佳答案

看来你可以use relative URLs for submodules .来自 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

因此,如果您在两个站点(即 github.com/you/parent-projectbitbucket.org/you/parent-projectgithub.com/you/child-projectbitbucket.org/you/child-project)中遵循相同的命名约定,您应该能够像这样设置子模块:

[submodule "programs/mgr-nancy-demo"]
path = programs/mgr-nancy-demo
url = ../mgr-nancy-demo.git

测试一下 - YMMV!

关于git - git 子模块的多个 url - 每个远程子模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32317365/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com