我設置jenkins並存儲在同一臺服務器上。 Stash通過http運行良好。爲了讓Jenkins連接到Stash,我創建了一個ssh(使用Jenkins用戶,密鑰存儲在/var/lib/jenkins/.ssh/id_rsa.pub中)。如指南所述,我將此密鑰添加到了我的配置文件中,並在Administartion>服務器設置中啓用了ssh。Jenkins和Stash設置ssh密鑰
在詹金斯我安裝了插件的Git並在genarl配置:
全局配置user.name值
全局配置user.email價值
而在項目配置我成立以下領域:
庫網址:SSH://[email protected]:7999/AT/repository1.git
如果我跑ŧ他工作那麼我得到以下錯誤:
Building in workspace /var/lib/jenkins/jobs/Test Job/workspace
Checkout:workspace//var/lib/jenkins/jobs/Test Job/workspace - [email protected]
Using strategy: Default
Cloning the remote Git repository
Cloning repository ssh://[email protected]:7999/AT/repository1.git
git --version
git version 1.7.12.4
ERROR: Error cloning remote repo 'origin' : Could not clone ssh://[email protected]:7999/AT/repository1.git
hudson.plugins.git.GitException: Could not clone ssh://[email protected]:7999/AT/repository1.git
at hudson.plugins.git.GitAPI.clone(GitAPI.java:273)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1044)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:986)
at hudson.FilePath.act(FilePath.java:852)
at hudson.FilePath.act(FilePath.java:825)
at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:986)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1142)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1324)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:676)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:581)
at hudson.model.Run.execute(Run.java:1518)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:236)
Caused by: hudson.plugins.git.GitException: Command "/home/danilo/libexec/git-core/git clone --progress -o origin ssh://[email protected]:7999/AT/repository1.git /var/lib/jenkins/jobs/Test Job/workspace" returned status code 128:
stdout: Cloning into '/var/lib/jenkins/jobs/Test Job/workspace'...
stderr: Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:897)
at hudson.plugins.git.GitAPI.access$000(GitAPI.java:42)
at hudson.plugins.git.GitAPI$1.invoke(GitAPI.java:269)
at hudson.plugins.git.GitAPI$1.invoke(GitAPI.java:248)
at hudson.FilePath.act(FilePath.java:852)
at hudson.FilePath.act(FilePath.java:825)
at hudson.plugins.git.GitAPI.clone(GitAPI.java:248)
... 14 more
Trying next repository
ERROR: Could not clone repository
FATAL: Could not clone
hudson.plugins.git.GitException: Could not clone
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1056)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:986)
at hudson.FilePath.act(FilePath.java:852)
at hudson.FilePath.act(FilePath.java:825)
at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:986)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1142)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1324)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:676)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:581)
at hudson.model.Run.execute(Run.java:1518)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:236)
您可以使用ssh命令連接到存儲庫服務器嗎? –