Gitlab CI,ssh亚军

当我尝试在部署控制台中创建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应用程序时,如何在服务器上配置我的跑步者?

最佳答案 您需要检查config.toml的位置.你可以通过搜索来完成.

find / -name’config.toml’

如果结果将是

/etc/gitlab-runner/config.toml

你以root身份运行runner.你需要指定像/root/.ssh/id_rsa这样的完整路径.

如果不是 – 你在其他用户下运行它,你需要指定目录,如/home/user/.ssh/id_rsa.

要找出你是哪个用户 – 注册shell执行程序并运行pwd或whoami

我相信如果不是root,那将是gitlab-runner.

点赞