Fix rsync “Host Key Verification Failed” in Jenkins

If you got the following error in Jenkins output using rsync:

Running "shell:sync" (shell) task
Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9]
Warning: Command failed: Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9]
 Use --force to continue.

Try the following:

  • su -s /bin/bash jenkins, since Jenkins install doesn’t have login shell by default on CentOS
  • ssh into target server
  • When prompt “Are you sure you want to continue connecting (yes/no)?”, type yes
  • Rerun the job

1 thought on “Fix rsync “Host Key Verification Failed” in Jenkins

Comments are closed.