如何将私有 Git 存储库添加为公共 Git 存储库中的子模块?

问题描述 投票:0回答:1

两者均由 GitLab 托管。我想将私有

gitlab.com/rokejulianlockhart/s4a3h4.git
添加到公共
gitlab.com/rokejulianlockhart/rokejulianlockhart.git
,以便它对其他人和我来说显示为目录,但只能由我自己访问。

我不知道从哪里开始。互联网上的所有内容似乎都提到将公共 Git 子模块添加到公共存储库,以便可以同时编辑它们。但是,我知道我想要的配置是可能的每个这个答案

git gitlab git-submodules
1个回答
0
投票

git submodule add "$Repository"

就我而言,
$Repository

是:

$Repository = 'https://gitlab.com/rokejulianlockhart/s4a3h4.git'

仍然足以将其克隆为子模块。具体来说,它枚举了
s4a3h4.git

并将其添加到

rokejulianlockhart.git
的内容中,仅添加了一个文件:
[submodule "s4a3h4"]
    path = s4a3h4
    url = https://gitlab.com/rokejulianlockhart/s4a3h4.git

然而,更有趣的部分当然是,当未经身份验证的人访问时,这是否仍然安全。在这方面,访问 
https://gitlab.com/rokejulianlockhart/rokejulianlockhart/-/tree/66f0a5ee0623fc2d985b183a72662ec9aa947397

确实会显示子模块存在,但 GitLab 不允许用户通过门户网站访问它。

© www.soinside.com 2019 - 2024. All rights reserved.