While trying to execute some shell command to a remote server from Jenkins, I am getting "Host key verification failed." error.
I have installed Jenkins in a docker on my MAC. Now from the Jenkins browser, I want to run some shell command to a remote server (which is accessible). To do that I already added the server (10.206.y.z) in the configure page of jenkins (by providing hostname i.e. 10.206.y.z, username & the key generated in 10.206.y.z server in the SSH Servers section) & tested the connection. The connection test passed & then I saved the configuration.
For executing shell command on 10.206.y.z, I created a FreeStyle project & in the Execute Shell section I am passing ssh [email protected] 'hostname'. If I run the project by clicking 'Build Now', I am getting the below error & the build fails.
Running as SYSTEM Building in workspace /var/jenkins_home/workspace/TestProject [TestProject] $ /bin/sh -xe /tmp/jenkins4234161871485451783.sh + ssh [email protected] hostname Host key verification failed. Build step 'Execute shell' marked build as failure Finished: FAILURE
Any help please?