我在gitlab有2个项目 . 对于示例目的,我们称之为 foo/main
和 foo/dep
.
在 foo/main
我正在使用gitlab-ci和另一台机器上运行的docker-runner来执行自动化测试和构建 .
由于 foo/dep
是 foo/main
的依赖项,我需要在构建main时git克隆它 .
两个存储库都是私有/具有受限访问权限 .
如何授予docker-runner访问其他repo的权限?
目前我收到的是:
npm ERR! Host key verification failed.
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
2 回答
如GitLab CI runner - can't access other repository所述,您可以通过
gitlab-runner/config.toml
将自己的.ssh-keys暴露给docker-container .我希望这不是唯一的解决方案,因为将密钥公开给任何有人推入回购的密钥可能是不安全的 .
单击配置文件图片下方项目容器右上角的
Settings
. 然后选择Deploy Keys
部分并将您的ssh public key
计算机添加到项目中 . 有关生成ssh key
参考https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2的更多信息