首页 > 解决方案 > 如何为 GitLab CI 克隆私有子模块 GitHub

问题描述

我有以下情况:我正在使用来自 GitHub 的私有子模块执行 GitLab CI,并在我的管道中获取下一条消息:

致命:无法读取“https://github.com”的用户名:没有这样的设备或地址致命:将“https://github.com/username/project”克隆到子模块路径“/my_gitlab_username/my_gitlab_project”失败

致命:无法读取“https://github.com”的用户名:没有这样的设备或地址致命:将“https://github.com/username/project”克隆到子模块路径“/my_gitlab_username/my_gitlab_project”失败

第二次克隆 'submodule_name' 失败,中止

如何设置令牌或有助于克隆 GitHub 私人仓库的东西?

标签: gitgithubgitlabgitlab-cigitlab-ci-runner

解决方案


要克隆存储库,您可能需要使用令牌:

git config --global credential.helper 存储

git clone https://your_username:your_github_token@github.com/username/private-repo.git

否则使用 curl api 调用


推荐阅读