Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Setup an additional SSH key in pipeline

Andrei Henea February 7, 2024

Hi everyone,

I have a SSH Key setup in my repository for which the deploy on the remote server works fine.

Now I'm trying to set a new SSH key to deploy the changes on a new server. I followed the instructions in the documentation below but I can't get it work. Pipeline fails with "Permission denied (public key)" error.

The private key has been correctly encoded and added as a secure variable, no doubt about this.

The public key is installed on the remote host on ~/.ssh/authorized_keys

I'm not sure about the "my_known_hosts" file. I've generated this file on the local machine by specifying the correct host and I committed to my repository. The public key in "my_known_hosts" file is different than one from  "~/.ssh/authorized_keys". 

In the remote server I don't have any "know_hosts" file and I'm not sure if I should have.

Any help would be greatly appreciated


1 answer

1 vote
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 8, 2024

Hello @Andrei Henea ,

thank you for reaching out to Community!

Could you add the following ssh command in your pipeline, run it again, and share with us the full log output? 

ssh -Tvvv <user>@<host>

This will include verbose logs in the SSH command which will include additional information that can help on the investigation, such as which key SSH is trying to use, and also if your server's fingerprint were correctly validated in the known_hosts file.

When sharing the logs here, please make sure to sanitize any sensitive information (IP address, username, repository, etc) as this is a public forum :)

Thank you, @Andrei Henea !

Patrik S

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events