I'm trying to setup Jenkins on my mac mini in order to pull my iOS project source code from BitBucket and build it automatically. I've already gone through the major well know problems generating the ssh keys,uploading them in BitBucket,performing an ssh connection by console for adding the host to the well know list (you can find all my adventure here and here). Now,there are 3 user in my system: A,B and Shared. When I installed Jenkins it automatically placed itself in Shared, but I generated the ssh keys with the user A. So just to be clear In the A home directory there is an .ssh directory with public and private keys.
When I try to run by Jenkins job I get this error message:
Started by user anonymous
Building in workspace /Users/Shared/Jenkins/Home/jobs/myprojectAdHocBuild/workspace
Checkout:workspace / /Users/Shared/Jenkins/Home/jobs/myprojectAdHocBuild/workspace - hudson.remoting.LocalChannel@625cb0bb
Using strategy: Default
Cloning the remote Git repository
Cloning repository
[email protected]:myuser/myproject.git
git --version
git version 1.8.0
ERROR: Error cloning remote repo 'origin' : Could not clone
[email protected]:myuser/myproject.git
hudson.plugins.git.GitException: Could not clone
[email protected]:myuser/myproject.git
at hudson.plugins.git.GitAPI.clone(GitAPI.java:271)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1036)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:978)
at hudson.
FilePath.act(FilePath.java:851)
at hudson.
FilePath.act(FilePath.java:824)
at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:978)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1134)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1325)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:676)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:581)
at hudson.model.Run.execute(Run.java:1516)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:236)
Caused by: hudson.plugins.git.GitException: Command "/usr/local/git/bin/git clone --progress -o origin
[email protected]:myuser/myproject.git /Users/Shared/Jenkins/Home/jobs/myprojectAdHocBuild/workspace" returned status code 128:
stdout: Cloning into '/Users/Shared/Jenkins/Home/jobs/myprojectAdHocBuild/workspace'...
stderr: Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:885)
at hudson.plugins.git.GitAPI.access$000(GitAPI.java:40)
at hudson.plugins.git.GitAPI$1.invoke(GitAPI.java:267)
at hudson.plugins.git.GitAPI$1.invoke(GitAPI.java:246)
at hudson.
FilePath.act(FilePath.java:851)
at hudson.
FilePath.act(FilePath.java:824)
at hudson.plugins.git.GitAPI.clone(GitAPI.java:246)
... 14 more
Trying next repository
ERROR: Could not clone repository
FATAL: Could not clone
hudson.plugins.git.GitException: Could not clone
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1048)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:978)
at hudson.
FilePath.act(FilePath.java:851)
at hudson.
FilePath.act(FilePath.java:824)
at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:978)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1134)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1325)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:676)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:581)
at hudson.model.Run.execute(Run.java:1516)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:236)
As you can see it fails when Hudson try to run the GIT command. The odd things is that if I try to run
/usr/local/git/bin/git clone --progress -o origin
[email protected]:myuser/myproject.git /Users/Shared/Jenkins/Home/jobs/myprojectAdHocBuild/workspace
In my console, it works fine (after fixing a small problem relative the folder write permission with chmod)
I found a post reporting a similar error which names a number of possible options but I'm not sure how to perform correctly these operations on my console. It looks like Jenkins is trying to run a command with a user which doesn't have permission to retrieve the appropriate keys from my .ssh directory.Not really sure.Maybe this output can help:
MacMini:~ myuser$ ps axu | grep "/jenkins"
myuser 11660 0.0 4.6 2918124 97096 ?? S 6:59pm 1:05.63 /usr/bin/java -jar /Users/myuser/Library/Caches/org.jenkins-ci.jenkins/jenkins.war
jenkins 9896 0.0 9.0 2939824 188552 ?? Ss 4:06pm 17:55.91 /usr/bin/java -jar /Applications/Jenkins/jenkins.war
myuser 11930 0.0 0.0 2432768 588 s000 S+ 10:28am 0:00.00 grep /jenkins
MacMini:~ myuser$ ps axu | grep tomcat
myuser 11932 0.0 0.0 2432768 588 s000 S+ 10:28am 0:00.00 grep tomcat
MacMini:~ myuser$
I really hope to fix this problem, because I would like to write a very detailed tutorial with all the information I found disseminated around the web.