Gitlab Runner Hangs on SSH

81 Views Asked by At

When I try to use SSH in GitLab runner that runs on Windows 10 machine and start pipeline the runner hangs on SSH command. I think it waits password or something else. I have added host and target machine public keys to "Deploy Keys". I am able to connect target machine in PowerShell or CMD without any password but the runner can not do it. Any ideas?

1

There are 1 best solutions below

4
mpolitze On

I assume you want to SSH to some server in your script. More details on the exact command that hangs would be helpful.

Apart from password SSH could be missing the host key so it waits for user input to accept it. If it is a single server try running

 ssh-keygen -R hostname

once in a job. This will update your known_hosts file. If you run on Windows that should be persistent.

If the server keeps changing you might have to run the command on every build. This comes with some severe security drawbacks and makes your CI vulnerable to MITM attacks.