当我尝试在部署控制台中创建ssh runner时出现此错误:
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密钥,此密钥位于〜/ .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应用程序时,如何在服务器上配置我的跑步者?
答案 0 :(得分:1)
您需要检查config.toml的位置。您可以通过搜索来完成。
find / -name 'config.toml'
如果结果是
/etc/gitlab-runner/config.toml
您以root
的身份运行跑步者。您需要指定完整路径,例如/root/.ssh/id_rsa
。
如果不是 - 您在其他用户下运行它,则需要指定/home/user/.ssh/id_rsa
之类的目录。
要找出您是哪个用户,请注册shell
执行者并运行pwd
或whoami
如果不是gitlab-runner
,我相信会是root
。
答案 1 :(得分:0)
就我而言,我将~/.ssh/id_rsa
路径更改为/root/id_rsa
。
当我在config.toml
中更改时,它没有帮助,但重新配置跑步者可以解决这个问题。