问题:
有没有办法通过与主存储库相同的方法(ssh或https)自动检出git子模块?
背景:
我们有一个非公开的gitlab存储库(main),它有一个子模块(utils),它也作为非公共gitlab存储库托管在同一台服务器上.可以通过ssh或https访问这些存储库:
user@gitlabserver.com:my/path/repo.githttps://gitlabserver.com/my/path/repo.git两种变体显然都需要不同形式的认证,并且取决于客户端计算机和用户,优选一种或另一种.
对于main不是问题的顶级存储库(),任何人都可以选择他或她喜欢的方法,但对于子模块,这取决于.gitmodules文件,因此(最初)对所有人都是相同的.
现在,而不是每个人都必须将.gitmodules文件调整为他们喜欢的任何内容,并确保他们不会意外地提交这些更改,如果有一种方法只需指定服务器和repo路径并且git选择其中一个,那就太好了.用于主repo的方法,或者可以在gitconfig中设置的方法.
我无法克隆我的私有git存储库中存在的子模块.我有权访问整个存储库,
使用了以下命令但是工作,请帮忙.克隆现有存储库中子模块的正确方法是什么?
djrecker$ git submodule update --init --recursive
Submodule 'Path' (git@github.com:Path) registered for path 'App'
Cloning into 'Path'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Run Code Online (Sandbox Code Playgroud) 操作系统:Linux
git 版本:2.26.2
我的仓库的 Git 仓库提供者:gitlab
失败子模块的回购提供者:Github
.gitmodules
[submodule "libraries/stb"]
path = libraries/stb
url = https://github.com/nothings/stb.git
branch = master
[submodule "libraries/harfbuzz"]
path = libraries/harfbuzz
url = https://github.com/harfbuzz/harfbuzz.git
branch = master
[submodule "libraries/shaderc"]
path = libraries/shaderc
url = https://github.com/google/shaderc.git
branch = master
[submodule "libraries/freetype2"]
path = libraries/freetype2
url = https://github.com/aseprite/freetype2.git
branch = master
[submodule "libraries/VulkanMemoryAllocator"]
path = libraries/VulkanMemoryAllocator
url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
branch = master
[submodule "libraries/googletest"]
path = libraries/googletest
url = https://github.com/google/googletest.git
branch = master
[submodule "libraries/Eigen"]
path = libraries/Eigen
url …Run Code Online (Sandbox Code Playgroud)