I’ve been racking my brain about this all day.
Now, I’ve followed the instruction at https://docs.gitlab.com/ce/ci/ssh_keys/README.html#how-it-works and I’ve:
- Generated an SSH key at git.kevdotbadger.com (on the server, not the runner)
- Copied the key at ~/.ssh/id_rsa to a variable called SSH_PRIVATE_KEY
- Copy/pasted the before_scripts from the above URL.
This works (as in doesnt throw any issues). I also:
- Added “- ssh-keyscan staging.kevdotbadger.com >> ~/.ssh/known_hosts”
- Added “- chmod 644 ~/.ssh/known_hosts”
To the before_script.
I then copied the file at ~/.ssh/id_rsa.pub" then shelled into the staging.kevdotbadger.com server and added it to ~/.ssh/authorized_keys
I gets all the way to opening an SSH connection then fails with
Permission denied (publickey).