2013-08-04 106 views
0

我正在嘗試整合jenkins和git。在jenkins作業配置中,我添加了 ssh://[email protected]:29418/xxx.git。當我選擇現在推送或任何gerrit事件時,構建會被觸發,但由於下面的錯誤,構建失敗。我成功地配置了gerrit插件。但是git的客戶端插件拋出以下錯誤無法集成jenkins和git

Cloning the remote Git repository 
    Cloning repository ssh://[email protected]:29418/xxx.git 
    git --version 
    git version 1.7.9.5 
    ERROR: Error cloning remote repo 'xxx' : Could not clone ssh://[email protected]:29418/xxx.git 
    hudson.plugins.git.GitException: Could not clone ssh://[email protected]: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://[email protected]: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 
+0

可能重複[Jenkins主機密鑰驗證失敗](http://stackoverflow.com/questions/15174194/jenkins-host-key-verification-failed) –

回答

3

詹金斯用戶(比如說 - jksvc)試圖連接到您的git的服務器(比如[email protected])。

SSH會提示您創建〜/ .ssh/known_hosts文件。

在這種情況下,嘗試在命令行訪問一次混帳爲「jksvc」用戶並接受SSH提示如果有的話爲「是」

驗證克隆正確地創建並觸發一個詹金斯工作

+0

..或者您可以在主頁編輯.ssh/known_hosts詹金斯服務用戶的目錄。 – LRA

+0

在這一刻jenkins正在運行tomcat7,我已經將/usr/share/tomcat7/.ssh/id_rsa.pub複製到gerrit。我可以從shell中克隆。 – geekgugi

+0

如果你(如jenkins用戶示例jksvc)能夠克隆,只需檢查jenkins中的git url是否正確。 – forvaidya

0

嘗試使用/而不是:在回購地址: ssh:// jenkins @ xxxx:29418/xxx.git。