当我尝试在部署控制台中创建 ssh 运行程序时,出现此错误:
Running with gitlab-ci-multi-runner 1.7.1 (f896af7)
Using SSH executor...
ERROR: Preparation failed: open ~/.ssh/id_rsa.pub: no such file or directory
Will be retried in 3s ...
Using SSH executor...
ERROR: Preparation failed: open ~/.ssh/id_rsa.pub: no such file or directory
Will be retried in 3s ...
Using SSH executor...
ERROR: Preparation failed: open ~/.ssh/id_rsa.pub: no such file or directory
Will be retried in 3s ...
ERROR: Build failed (system failure): open ~/.ssh/id_rsa.pub: no such file or directory
在我的服务器上,我创建了 ssh key ,该 key 位于目录 ~/.ssh/id_rsa.pub 中。 我的 .gitlab-ci.yml 文件:
stages:
- deploy
before_script:
- whoami
mate-finder:
stage: deploy
script:
- sudo apt-get update -qy
- sudo apt-get install -y nodejs
- sudo npm install
- sudo ng build
- sudo ng serve
如何在服务器上部署我的应用程序?当我想在服务器上部署我的 angular2 应用程序时,我必须如何在服务器上配置我的运行器?
最佳答案
您需要检查 config.toml 的放置位置。您可以通过搜索来完成。
查找/-name'config.toml'
如果结果是
/etc/gitlab-runner/config.toml
您以root
身份运行运行者。并且您需要指定完整路径,例如 /root/.ssh/id_rsa
。
如果没有 - 您在其他用户下运行它,并且需要指定目录,例如 /home/user/.ssh/id_rsa
。
要查明您是哪个用户 - 注册 shell
执行器并运行 pwd
或 whoami
我相信如果不是root
,它就是gitlab-runner
。
关于ssh - Gitlab CI、ssh 运行程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40657461/