问题描述
我有一个利用GitLab CI的GitLab项目.该项目还使用子模块,该项目及其子模块都在同一个GitLab帐户下.
I have a GitLab project that utilises GitLab CI.The project also uses submodules, both the project and it's submodules are under the same GitLab account.
这是我的.gitmodules
文件
[submodule "proto_contracts"]
path = proto_contracts
url = https://gitlab.com/areller/proto_contracts.git
我在.gitlab-ci.yml文件中也有这本书
I also have this piece in the .gitlab-ci.yml file
variables:
GIT_SUBMODULE_STRATEGY: recursive
但是,当我运行CI时,会出现此错误
However, when i run the CI I get this error
fatal: could not read Username for 'https://gitlab.com': No such device or address
该项目和子模块都在一个私有存储库中,因此您可能会提示您进行身份验证,但是正如我已经提到的,该项目和子模块都在同一帐户下,并且运行者的一项工作是克隆原始存储库
Both the project and the submodules are in a private repository so you would expect to be prompted for authentication, but as I've mentioned, the project and the submodule are under the same account and one of the runner's jobs is to clone the original repository
所以奇怪的是它无法到达子模块有办法解决吗?
So it's odd that it's unable to reach the submoduleIs there a way around it?
推荐答案
您必须为子模块使用相对URL .如下更新您的.gitmodules
:
You must use relative URLs for submodules. Update your .gitmodules
as follow:
[submodule "proto_contracts"]
path = proto_contracts
url = ../../areller/proto_contracts.git
进一步阅读:在GitLab CI中使用Git子模块| GitLab文件
这篇关于GitLab在CI内部拉出子模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!