Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jenkins/hudson can't connect to github repo

Tags:

I am on Ec2 with the base amazon ami linux- I have installed jenkins but when I go to pull the repo from github I am given the following error:

Building in workspace /var/lib/jenkins/workspace/build social Checkout:build social / /var/lib/jenkins/workspace/build social - hudson.remoting.LocalChannel@5c7b21b Using strategy: Default Cloning the remote Git repository Cloning repository origin ERROR: Error cloning remote repo 'origin' : Could not clone [email protected]:adulion/.git hudson.plugins.git.GitException: Could not clone [email protected]:adulion/.git     at hudson.plugins.git.GitAPI.clone(GitAPI.java:245)     at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1117)     at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1059)     at hudson.FilePath.act(FilePath.java:832)     at hudson.FilePath.act(FilePath.java:814)     at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1059)     at hudson.model.AbstractProject.checkout(AbstractProject.java:1218)     at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:581)     at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:470)     at hudson.model.Run.run(Run.java:1421)     at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)     at hudson.model.ResourceController.execute(ResourceController.java:88)     at hudson.model.Executor.run(Executor.java:238) Caused by: hudson.plugins.git.GitException: Command "git clone --progress -o origin [email protected]:adulion/.git /var/lib/jenkins/workspace/build social" returned status code 128: stdout: Cloning into /var/lib/jenkins/workspace/build social...  stderr: Host key verification failed. fatal: The remote end hung up unexpectedly 

I have generated a key for the current user who installed jenkins and have managed to clone the repo using the git command line but jenkins can not.

I have copied the ~/.ssh files into /var/lib/jenkins/.ssh

I have added github to the known hosts and I have run out of solutions to try. Anyone know where I am going wrong? Is there a way to get jenkins to show the public key it's using and I can debug if it's using the correct one?

I removed the name of the repo because its a private repo

like image 302
Chris Mccabe Avatar asked Apr 19 '12 08:04

Chris Mccabe


People also ask

How do I clone a git repository using Jenkins?

Configuring Git with Jenkins Now open your project and go to configure. Step 2: Give the repository Url in Source Code Management, repository Url can be fetched by clicking on clone and download option of Github and you have to select the SSH Url. Also, add credentials there of Jenkins.

How do I download Git Jenkins plugin?

Install the Git Plugin in JenkinsGo to “Manage Jenkins>>Manage Plugins”, open the “Available” tab and search for “Git plugin”, click on install button wait until the installation is done.


1 Answers

The error seems to be: host key verification failed.

You should log into your Jenkins host as the Jenkins user and run:

ssh [email protected] 

Then answer yes to the prompt about the host key. This only needs to be done once.

Alternatively you could add "StrictHostKeyChecking no" to ~jenkins/.ssh/config.

like image 139
sti Avatar answered Oct 01 '22 00:10

sti