Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins plugin ssh-agent showing "ERROR: Failed to run ssh-add"

I getting error "ERROR: Failed to run ssh-add" I am trying to ssh into remote machine so

SSH credential are set pic1 Pipeline script is calling ssh-agent pic2 On executing the job I get error below pic3

I have tried this reported bug https://issues.jenkins-ci.org/browse/JENKINS-50181 but it is not working and bug has been already resolved in latest version 1.17 which i have now. Can anyone suggest how to fix this issue.

like image 720
Vivek Raj Avatar asked Aug 22 '19 08:08

Vivek Raj


2 Answers

This is just a wild guess since this could have different reasons.

But I just had this error, and my problem was that when I created the credential in Jenkins I forgot to add a linebreak at the end of the input.

...
...<all the usual content>...
...
-----END OPENSSH PRIVATE KEY-----<linebreak needed here>
like image 115
peedee Avatar answered Oct 10 '22 22:10

peedee


I got this error when I put the SSH public key into the Jenkins credential instead of properly putting the private key.

Note that the private key is the long one that looks like this:

-----BEGIN RSA PRIVATE KEY-----
... lots of unreadable random characters for many lines ...
-----END RSA PRIVATE KEY-----
like image 3
Lee Meador Avatar answered Oct 10 '22 21:10

Lee Meador