Problem configuring Gitlab CI -> ssh: handshake failed


I tried to set up Gitlab CI on one of my gitlab project, but I ran through a problem with the ssh executor.
I get the following error:

Checking for builds… received ←[0;m build←[0;m=102 repo_url←[0;m=http://pc-name/group-name/Gitlab-Sandbox.git runner←[0;m=c3b55990
←[0;33mWARNING: Preparation failed: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password publickey], no supported methods remain←[0;m ←[0;33mbuild←[0;m=102 ←[0;33mproject←[0;m=80 ←[0;33mrunner←[0;m=c3b55990
Will be retried in 3s …

My gitlab server runs on a Ubuntu server, and the runner is on another computer running Windows 7

The runner is visible on gitlab and shown as running. Here is the config.toml:

concurrent = 1
check_interval = 0

name = “pc-name”
url = “
token = “tokenofmyproject”
executor = “ssh”
user = “user”
password = “userpassword”
host = “”
port = “22”
identity_file = “C:\Users\UserName\.ssh\ssh_runner/id_rsa”

I generated an ssh key with : ssh-keygen -t rsa -C “runner_ssh”
and I placed the public key in the “Deploy Keys” of my project

Do you have a clue about what I am messing up or missing ?


I wish someone from gitlab would respond to this issue, there are other similar ssh runner issues that no one is answering. Support asked me to turn on debug. It wasn’t very helpful because it doesn’t answer the fundamental question of how to set up an ssh agent with gitlab.

See Preparation failed: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

Here is debug process for this situation.

Verify you can logging to remote ssh server manually using same local user and same key file than gitlab-runner

sudo su - USER

eval `ssh-agent -s`

You should solve any issue here before continue.

Run gitlab-runner with log in debug mode

sudo vi /etc/gitlab-runner/config.toml

Add log_level = "debug"

# Sample
concurrent = 1
check_interval = 0
log_level = "debug"

Then restart gitlab-runner

sudo gitlab-runner restart

Retry to run buggy job.

If it does not help go to next step.

Launch remote sshd in debug mode

Run SSH daemon on another port as a part of the command (then you don’t need to lost your existing session, if already connect thought ssh)

sudo /usr/sbin/sshd -d -p 2200
# sudo /usr/sbin/sshd -dd -p 2200 - if you need more logs
# sudo /usr/sbin/sshd -ddd -p 2200 - if you need all logs

Warn: You should run this for each ssh connection.

Then modify gitlab-runner configuration (on gitlab runner host)

sudo vi /etc/gitlab-runner/config.toml

Add port = "2200"

  name = "XXXXX"
  url = "https://XXXXX/"
  token = "XXXXX"
  executor = "ssh"
    user = "XXXXX"
    host = "XXXXX"
    port = "2200"
    identity_file = "XXXXX"

Retry to run buggy job.

On console sshd console you are able to see all gitlab-runner actions and you should be able to understand what is the issue.

1 Like