Jenkins 使用 github 返回状态码 128 [英] Jenkins returned status code 128 with github

查看:44
本文介绍了Jenkins 使用 github 返回状态码 128的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 GitHub 命令我有:

With GitHub command I have:

ssh -T git@github.com
Hi (MyName)! You've successfully authenticated, but GitHub does not provide shell access.

我与 GitHub 的连接正常(没问题),但使用 Jenkins 我有这个错误:

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

ERROR: Error cloning remote repo 'origin' : Could not clone git@github.com:Name-MysRepo/MyRepo.git
hudson.plugins.git.GitException: Could not clone git@github.com: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 git@github.com: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

这是公钥的问题吗?

我在 Tomcat 7/Ubuntu 12 下使用 Jenkins.

推荐答案

这个错误:

stderr:权限被拒绝(公钥).致命:远端意外挂断

表示 Jenkins 正在尝试使用错误的 ssh 密钥连接到 github.

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

你应该:

  1. 确定 jenkins 运行的用户,例如.构建"或詹金斯"
  2. 登录尝试进行克隆的 jenkins 主机 - 也就是说,如果节点实际上正在执行构建,则不要登录主节点.
  3. 尝试 ssh 到 github - 如果失败,则需要将正确的密钥添加到 <jenkins user home>/.ssh

这篇关于Jenkins 使用 github 返回状态码 128的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆