Has anyone found sshpass works to set a phassphrase for ssh or git clones?
I have a github repo with a deploy key and a passphrase
This results in prompt for passphrase as expected and clone upon manual key-in of it
git clone git@github:me/myrepo.git
This results in a hang
sshpass -p "secret" -v git clone git@github:me/myrepo.git
This seems to happen because the search string will never match the actual string but there seems no way to alter the search string.
SSHPASS searching for password prompt using match "assword"
SSHPASS read: Enter passphrase for key '/home/jenkins/.ssh/id_rsa':
Best Answer
That is because you cannot use sshpass to provide a passphrase, only a password in user/password vs private key ssh.
Assuming you are using Jenkins - and since you are me, you are. we can resolve the problem following this strategy:
thanks to @jayhendren for turning me on to the ssh-agent plugin
The Jenkins pipeline groovy code
Example