Reputation: 355
I've setup Jenkins to pull from a private repository on Github for a specific job. It appears the SSH key is not being used by Jenkins, despite the fact that I have generated a private/public key and added it to github as a deploy key.
When I git clone from the Jenkins user, I'm prompted for a username and password. Why isn't it using my ~/.ssh/id_rsa.pub key?
Thanks
Upvotes: 5
Views: 8858
Reputation: 11439
Just had the same problem, here is what you can do :
1) Login as jenkins users
sudo su jenkins
2) Generate keys for the jenkins user :
ssh-keygen -t rsa
3) Enter the id_rsa.pub as deploy key in the admin section of your repo on GitHub
Or even better :
Hope this helps, Vincent
Upvotes: 3
Reputation: 1247
Which url are you using? It sounds like you are using the https one instead of the ssh one.
At the top of your projects github page, there are buttons for three urls, HTTP, SSH, Git read-only. You want the SSH one.
Upvotes: 3