I'm trying to use gitlab CI/CD to auto deploy my code, after push on an specific branch (in my case 'staging' branch)
after push on 'staging' branch I see following error on jobs section in gitlab UI:
Running with gitlab-runner 15.0.0 (xxxxxx)
on deploy xxxxxx
Preparing the "ssh" executor
00:36
Using SSH executor...
ERROR: Preparation failed: ssh command Connect() error: ssh Dial() error: ssh: handshake failed: knownhosts: key is unknown
I can see gitlab from my VM and gitlab-runner registered successfully before.
I've also created ssh key and add it to gitlab-runner installation steps.
You need to check what SSH URL is used in your case.
Something like
[email protected]:me/myProject
would look for gitlab.com SSH host keys fingerprints in an~/.ssh/known_hosts
file.Make sure to add first in gitlab-runner server the following to
~/.ssh/known_hosts
:That will skip manual fingerprint confirmation in SSH.
In other words, no more "
knownhosts: key is unknown
".Note that with GitLab 15.3 (August 2022), you will have an easier time finding those: