Jenkins fails with github "git clone"
When I do build in Jenkins, it fails with this error. Any idea?
ERROR: Error cloning remote repo 'origin' : Could not clone git@github.com:test/test.git
ERROR: Cause: Error performing command: git clone --progress -o origin
开发者_如何学Cgit@github.com:test/test.git /var/lib/jenkins/jobs/test/workspace
Command "git clone --progress -o origin git@github.com:test/test.git
/var/lib/jenkins/jobs/test/workspace" returned status code 128: Initialized empty Git
repository in /var/lib/jenkins/jobs/test/workspace/.git/
No protocol specified
(ssh-askpass:801): Gtk-WARNING **: cannot open display: :0.0
Host key verification failed.
fatal: The remote end hung up unexpectedly
You need to copy your private ssh key into the .ssh
folder beneath Jenkins. Something like (on Ubuntu Lucid):
/var/lib/jenkins/.ssh
Host key verification failed. - make sure your SSH keys are setup properly.
http://help.github.com/linux-set-up-git/
After you are done with that,
ssh git@github.com
should give you a welcome message ( which also says no shell access ) from GitHub
Had the same problem, even though the ssh-keys were correctly set up.
The issue was that on the first connection attempt, the git-server needed to be added to the known hosts file
/.ssh/known_hosts
. Git prompts you for this on first connect-attempt: Are you sure you want to continue connecting (yes/no)?, but Jenkins did not nor can it pass on the prompt, so it failed silently.
We solved it by walking to our ops-guy, bringing him a nice cup of espresso, and had him do a random git-checkout, where he answered yes to said prompt :) After that, checkouts through Jenkins worked as expected.
Found the clue here: http://www.ipsure.com/blog/2010/ssh-public-key-w-rsa-authentication-and-ssh-tunneling-part-1/
If you still have the Host key verification failed problem I answered a similar problem with a step by step solution here :
Jenkins & Github not using SSH Key
Actually, I ended up with simply using https instead of ssh to clone the repository from GitHub to Jenkins.
So instead of: git@github.com:[user]/[repository].git
I used: https://github.com/[user]/[repository].git
as the repository URL.
精彩评论