Jenkins polling on GIT server was failing with below error
FATAL: hudson.plugins.git.GitException ...
.
.
stderr: Host key verification failed
Though error was clearly telling its a ssh host key verification issue, it took a while to figure out the root cause.
I'm running Jenkins poll from a node, not from master. But Jenkins poll was still referring to master machine, where the ssh configuration was improper.
If you install the Jenkins on Linux by using Jenkins rpm, it will setup a ssh at /var/lib/jenkins/.ssh.
And it doesn't create ssh public/private keys.
But to create a ssh key, you need to use "jenkins" user account.
By default the rpm will create below entry in /etc/passwd file
jenkins:x:494:489:Jenkins Continuous Build server:/var/lib/jenkins:/bin/false
change it to
jenkins:x:494:489:Jenkins Continuous Build server:/var/lib/jenkins:/bin/bash
Now create ssh keys
FATAL: hudson.plugins.git.GitException ...
.
.
stderr: Host key verification failed
Though error was clearly telling its a ssh host key verification issue, it took a while to figure out the root cause.
I'm running Jenkins poll from a node, not from master. But Jenkins poll was still referring to master machine, where the ssh configuration was improper.
If you install the Jenkins on Linux by using Jenkins rpm, it will setup a ssh at /var/lib/jenkins/.ssh.
And it doesn't create ssh public/private keys.
But to create a ssh key, you need to use "jenkins" user account.
By default the rpm will create below entry in /etc/passwd file
jenkins:x:494:489:Jenkins Continuous Build server:/var/lib/jenkins:/bin/false
change it to
jenkins:x:494:489:Jenkins Continuous Build server:/var/lib/jenkins:/bin/bash
Now create ssh keys
- su jenkins
- ssh-keygen
It will create new "id_rsa" & "id_rsa.pub" files.
Now copy the content of "id_rsa.pub" file to your GIT server ( we use atlassian stash).
Now try the git command which was failing
-bash-4.1$ git ls-remote -h ssh://xxxx@xxxx.com:7999/xxxx/yyyy.git rel-2.0
Are you sure you want to continue connecting (yes/no)? yes
Now it will add the host key to known_hosts file.
That's it, your GIT polling will start working ...
No comments:
Post a Comment