1

我已经敲了几个小时的头了...

在此处输入图像描述

这个错误没有改变。作为记录:

  1. 我试过:login jenkins在终端中,以红色显示的命令有效。
  2. 以 jenkins 身份登录时,我可以毫无问题地克隆 repo。
  3. SSH 密钥就位,它们显示在ssh-add -l
  4. known_hosts文件已正确配置
  5. 我已经 ssh 到 github.com 来添加它known_hosts
  6. 将“存储库 URL”替换为公共存储库是可行的https://github.com/...
  7. 我拔掉了我的大部分头发,还剩下一些……

我怀疑是什么问题?

当我复制生成的 SSH 密钥时~jenkins/.ssh/id_rsa.pub,我注意到在密钥的末尾,它显示为:root@MyComputer,而不是 jenkins... 因为我必须使用它sudo ssh-keygen来生成密钥...这很糟糕吗?

这是完整的构建日志:

开始 b

y user [8mha:AAAAlh+LCAAAAAAAAP9b85aBtbiIQTGjNKU4P08vOT+vOD8nVc83PyU1x6OyILUoJzMv2y+/JJUBAhiZGBgqihhk0NSjKDWzXb3RdlLBUSYGJk8GtpzUvPSSDB8G5tKinBIGIZ+sxLJE/ZzEvHT94JKizLx0a6BxUmjGOUNodHsLgAzOEgYu/dLi1CL9vNKcHACFIKlWvwAAAA==[0manonymous
Building in workspace /Users/Shared/Jenkins/Home/jobs/RTSBuilder/workspace
Checkout:workspace / /Users/Shared/Jenkins/Home/jobs/RTSBuilder/workspace - hudson.remoting.LocalChannel@210aaf84
Using strategy: Default
Cloning the remote Git repository
Cloning repository git@github.com:organization/myRepo.git
git --version
git version 1.7.12.4 (Apple Git-37)
ERROR: Error cloning remote repo 'origin' : Could not clone git@github.com:organization/myRepo.git
[8mha:AAAAWB+LCAAAAAAAAP9b85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0ldFVf2c+b/lb5MDAwVRQxSaBqcITRIIQMEMIIUFgAAckCEiWAAAAA=[0mhudson.plugins.git.GitException: Could not clone git@github.com:organization/myRepo.git
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:248)
    at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.clone(AbstractGitAPIImpl.java:59)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.clone(CliGitAPIImpl.java:40)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1012)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:948)
    at hudson.FilePath.act(FilePath.java:909)
    at hudson.FilePath.act(FilePath.java:882)
    at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:948)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1114)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1411)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:657)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:562)
    at hudson.model.Run.execute(Run.java:1604)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:246)
Caused by: hudson.plugins.git.GitException: Command "git clone --progress -o origin git@github.com:organization/myRepo.git /Users/Shared/Jenkins/Home/jobs/RTSBuilder/workspace" returned status code 128:
stdout: Cloning into '/Users/Shared/Jenkins/Home/jobs/RTSBuilder/workspace'...

stderr: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:873)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:851)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:40)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:246)
    ... 16 more
Trying next repository
ERROR: Could not clone repository
[8mha:AAAAWB+LCAAAAAAAAP9b85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0ldFVf2c+b/lb5MDAwVRQxSaBqcITRIIQMEMIIUFgAAckCEiWAAAAA=[0mjava.io.IOException: Could not clone
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1025)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:948)
    at hudson.FilePath.act(FilePath.java:909)
    at hudson.FilePath.act(FilePath.java:882)
    at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:948)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1114)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1411)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:657)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:562)
    at hudson.model.Run.execute(Run.java:1604)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:246)
Finished: FAILURE
4

2 回答 2

1

这也可能是这个 SO 用户发现的插件问题。我也验证了它,不过,我使用的是 https 而不是 git 协议。如果我跑

git 克隆https://blah.com:8443/blah.git

从外壳,它可以工作。如果我在 Jenkins 里面运行它

Build>Execute shell>Command,也可以。就在我在

源代码管理>Git>Repository URL 框,它不起作用。

于 2013-11-04T17:27:59.097 回答
1

我通过将 Jenkins 启动从启动守护进程更改为启动代理解决了 OSX 上的这个问题,希望这对你有用。

于 2013-11-01T20:24:07.353 回答