为 gitlab 配置 ssh runner ssh denied

Configuring ssh runner for gitlab ssh denied

我正在尝试为 angular 项目设置一个简单的 gitlab CI

我刚刚在临时服务器上创建了一个运行器。

这是 /etc/gitlab-runner

中 config.toml 的摘录
  name = "awsTest10"
  url = "http://gitlab.XXXXXXX/ci"
  token = "XXXXXXXXXXXXXXXXXXXXX"
  executor = "ssh"
  [runners.ssh]
    user = "root"
    host = "ec2-XX-XX-XX-XX.eu-west-1.compute.amazonaws.com"
    port = "22"
    identity_file = "/root/.ssh/id_rsa"
  [runners.cache]

我用 root 创建了一个 ssh 密钥,我复制了 gitlab 部署密钥中的 public 部分。我之前做过ssh-add。

当我使用跑步者时,我得到以下结果:

Running with gitlab-ci-multi-runner 1.11.1 (a67a225)
  on awsTest10 (e1ce142d)
Using SSH executor...
ERROR: Preparation failed: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Will be retried in 3s ...
Using SSH executor...
ERROR: Preparation failed: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Will be retried in 3s ...
Using SSH executor...
ERROR: Preparation failed: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Will be retried in 3s ...
ERROR: Job failed (system failure): ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

感谢帮助

我遇到了同样的问题。我将 public 键附加到 ~/.ssh/authorized_keys 并取消注释 /etc/ssh/sshd_config 文件中的 AuthorizedKeysFile %h/.ssh/authorized_keys 行。然后我重新启动了 ssh 服务,它对我有用。