Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
646 views
in Technique[技术] by (71.8m points)

Jenkins returned status code 128 with github

With GitHub command I have:

ssh -T [email protected]
Hi (MyName)! You've successfully authenticated, but GitHub does not provide shell access.

My connection with GitHub is ok (no problem), but with Jenkins I have this error:

ERROR: Error cloning remote repo 'origin' : Could not clone [email protected]:Name-MysRepo/MyRepo.git
hudson.plugins.git.GitException: Could not clone [email protected]:Name-MysRepo/MyRepo.git
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.clone(CliGitAPIImpl.java:219)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1001)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:942)
    at hudson.FilePath.act(FilePath.java:904)
    at hudson.FilePath.act(FilePath.java:877)
    at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:942)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1101)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1369)
    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:1575)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:477)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:241)
Caused by: hudson.plugins.git.GitException: Command "git clone --progress -o origin [email protected]:Name-MysRepo/MyRepo.git /root/.jenkins/jobs/TestKRGDAOV01/workspace" returned status code 128:
stdout: Cloning into '/root/.jenkins/jobs/TestKRGDAOV01/workspace'...

stderr: Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Is this problem with public key?

I use Jenkins under Tomcat 7 / Ubuntu 12.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This error:

stderr: Permission denied (publickey). fatal: The remote end hung up unexpectedly

indicates that Jenkins is trying to connect to github with the wrong ssh key.

You should:

  1. Determine the user that jenkins runs as, eg. 'build' or 'jenkins'
  2. Login on the jenkins host that is trying to do the clone - that is, do not login to the master if a node is actually doing the build.
  3. Try you ssh to github - if it fails, then you need to add the proper key to <jenkins user home>/.ssh

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...