配置ssh runner用于gitlab ssh被拒绝

时间:2017-06-17 00:45:41

标签: ssh continuous-integration gitlab handshake runner

我试图为角项目设置一个简单的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中复制了公共部分。我之前做了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

感谢您的帮助

1 个答案:

答案 0 :(得分:3)

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