Question

I have a bash script, amongst other things, attempts to SCP a file from current host (Windows/Cygwin) to a remote host (Suse).

When I run the script in Cygwin myself, the script performs perfectly. Transfers the file via SCP, then SSH to the remote machine to run some further commands (to do with deploying the file to application server).

When the script is run by Maven as part of a Jenkins CI build it fails with an error about the key pair being rejected.

From the Jenkins job log:

Host key verification failed.
lost connection
Was it helpful?

Solution

Let your job run once with StrictHostKeyChecking:

scp -o 'StrictHostKeyChecking no' ...

This will log something like:

Warning: Permanently added '<host>, <ipaddr>' (<keytype>) to the list of known hosts.

After that, remove the StrictHostKeyChecking.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top