詹金斯发现找不到ssh密钥

时间:2012-08-23 18:34:12

标签: java git ubuntu bitbucket

当我以jenkins用户身份登录时,我在〜/ .ssh / id_rsa.pub中有一个ssh密钥。

我已经正确地将它导入了bitbucket并且已经接受了密钥。

当我尝试进行git克隆(到正确的URL)时,我仍然得到....

Building in workspace /var/lib/jenkins/jobs/Google adwords/workspace
Checkout:workspace / /var/lib/jenkins/jobs/Google adwords/workspace - hudson.remoting.LocalChannel@2c473996
Using strategy: Default
Cloning the remote Git repository
Cloning repository origin
ERROR: Error cloning remote repo 'origin' : Could not clone git@bitbucket.org:DAVID99WORLD/assessme.git
hudson.plugins.git.GitException: Could not clone git@bitbucket.org:DAVID99WORLD/assessme.git
    at hudson.plugins.git.GitAPI.clone(GitAPI.java:268)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1122)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1064)
    at hudson.FilePath.act(FilePath.java:842)
    at hudson.FilePath.act(FilePath.java:824)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1064)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1256)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:589)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:494)
    at hudson.model.Run.execute(Run.java:1502)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:477)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:236)
Caused by: hudson.plugins.git.GitException: Command "git clone --progress -o origin git@bitbucket.org:DAVID99WORLD/assessme.git /var/lib/jenkins/jobs/Google adwords/workspace" returned status code 128:
stdout: Cloning into '/var/lib/jenkins/jobs/Google adwords/workspace'...

stderr: Host key verification failed.
fatal: The remote end hung up unexpectedly

有谁知道为什么会这样?根据我读过的文档〜/ .ssh是jenkins用户存在的正确目录。

编辑:我的jenkins用户在〜/ .ssh中没有known_hosts文件,但我的根级用户没有 - 应该吗?我可以用我的jenkins用户做一个克隆就好了,并没有像jenkins用户那样提到主机。

1 个答案:

答案 0 :(得分:2)

它可能与known_hosts文件无关。我想,您必须检查Jenkins是否能够读取您的公共SSH密钥。因此,您可能需要检查:

  • 为/ etc / passwd中的Jenkins用户定义的主页匹配〜/ .ssh
  • Jenkins用户可以访问他的主目录(所以至少--x - x - x在所有目录上方)
  • Jenkins用户可以访问id_rsa.pub文件
  • Jenkins实际上是与Jenkins用户一起运行而不是tomcat用户

此外,如果删除当前的id_rsa.pub文件会发生什么?是否抱怨找不到公钥?

相关问题