Jenkins command line ssh: Host key verification failed despite ssh-agent
Posted by Admin • Thursday, August 4. 2016 • Category: DevOps, LinuxAfter hours of "Why does it work locally but not in Jenkins", this error boils down to StrictHostKeyChecking... In other words, since the job runs as a user on a random slave, and this user most likely doesn't have a known hosts file with an entry for the target system, this fails rather cryptically. You think that the user's keys don't work, but that's not the problem.
The whole setup boils down to :
- Install ssh-agent plugin
- Configure credentials with a valid ssh key for your target
- Enable ssh-agent with that credential entry in your job config
- Add StrictHostKeyChecking=no to whatever ssh command you are using. Some examples:
- GIT:
export GIT_SSH_COMMAND="ssh -oStrictHostKeyChecking=no"
- SSH:
ssh -oStrictHostKeyChecking=no ....
- GIT:
0 Comments
Add Comment