0

我正在尝试整合 jenkins 和 git。在jenkins作业配置中,我添加了ssh://jenkins@xxxx:29418/xxx.git。当我选择现在推送或任何 gerrit 事件时,会触发构建但由于以下错误而导致构建失败。我已经成功配置了gerrit插件,它说成功。但是git客户端插件抛出以下错误

 Cloning the remote Git repository
    Cloning repository ssh://jenkins@x.x.x.x:29418/xxx.git
    git --version
    git version 1.7.9.5
    ERROR: Error cloning remote repo 'xxx' : Could not clone ssh://jenkins@x.x.x.x:29418/xxx.git
    hudson.plugins.git.GitException: Could not clone ssh://jenkins@x.x.x.x:29418/xxx.git
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:226)
        at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.clone(AbstractGitAPIImpl.java:57)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.clone(CliGitAPIImpl.java:33)
        at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1006)
        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:1108)
        at hudson.model.AbstractProject.checkout(AbstractProject.java:1367)
        at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:674)
        at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
        at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:579)
        at hudson.model.Run.execute(Run.java:1575)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
        at hudson.model.ResourceController.execute(ResourceController.java:88)
        at hudson.model.Executor.run(Executor.java:237)
    Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git clone --progress -o xxx ssh://jenkins@x.x.x.x:29418/xxx.git /usr/share/tomcat7/.jenkins/jobs/xxx/workspace" returned status code 128:
    stdout: Cloning into '/usr/share/tomcat7/.jenkins/jobs/xxx/workspace'...

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

        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:790)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$100(CliGitAPIImpl.java:33)
        at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:224)
        ... 16 more
    Trying next repository
    ERROR: Could not clone repository
    java.io.IOException: Could not clone
        at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1019)
        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:1108)
        at hudson.model.AbstractProject.checkout(AbstractProject.java:1367)
        at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:674)
        at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
        at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:579)
        at hudson.model.Run.execute(Run.java:1575)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
        at hudson.model.ResourceController.execute(ResourceController.java:88)
        at hudson.model.Executor.run(Executor.java:237)
    Finished: FAILURE
4

2 回答 2

3

Jenkins 用户(例如 - jksvc)正在尝试连接到您的 git 服务器(例如 git@myserver.example.com)。

SSH 提示您创建 ~/.ssh/known_hosts 文件。

在这种情况下,尝试以“jksvc”用户身份在命令行上访问 git 一次,并接受 SSH 提示(如果有)为“是”

验证克隆是否正确创建,然后触发 jenkins 作业

于 2013-08-04T08:09:12.330 回答
0

尝试使用 / 而不是 : 在 repo 地址:ssh://jenkins@xxxx:29418/xxx.git。

于 2015-01-05T17:48:27.553 回答