GitLab pull submodules inside CI

元气小坏坏 提交于 2019-12-07 11:05:15

问题


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.

Here is my .gitmodules file

[submodule "proto_contracts"]
    path = proto_contracts
    url = https://gitlab.com/areller/proto_contracts.git

I also have this piece in the .gitlab-ci.yml file

variables:
  GIT_SUBMODULE_STRATEGY: recursive

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 submodule Is there a way around it?


回答1:


You must use relative URLs for submodules. Update your .gitmodules as follow:

    [submodule "proto_contracts"]
        path = proto_contracts
        url = ../../areller/proto_contracts.git

Further reading: Using Git submodules with GitLab CI | GitLab Docs



来源:https://stackoverflow.com/questions/48845464/gitlab-pull-submodules-inside-ci

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