我已经敲了几个小时的头了...
这个错误没有改变。作为记录:
- 我试过:
login jenkins
在终端中,以红色显示的命令有效。 - 以 jenkins 身份登录时,我可以毫无问题地克隆 repo。
- SSH 密钥就位,它们显示在
ssh-add -l
- 该
known_hosts
文件已正确配置 - 我已经 ssh 到 github.com 来添加它
known_hosts
- 将“存储库 URL”替换为公共存储库是可行的
https://github.com/...
。 - 我拔掉了我的大部分头发,还剩下一些……
我怀疑是什么问题?
当我复制生成的 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