通过Jenkins连接到Git服务器的麻烦

时间:2016-05-13 07:49:02

标签: git jenkins ssh git-clone

朋友们,我在Jenkins控制台中不断收到以下错误。

"Failed to connect to repository : Command "git -c core.askpass=true ls-remote -h ssh://yyyyyyyy@gerrit.xxxxxxxx.com:29418/mobile HEAD" returned status code 128:
stdout: 
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."

尝试了网络上的所有选项。没有任何效果。 感谢您的帮助

完成日志记录

Building in workspace /Users/Shared/Jenkins/GIT
Cloning the remote Git repository
Cloning repository ssh://yyyyy@gerrit.xxxxxxxx.com:29418/mobile
 > git init /Users/Shared/Jenkins/GIT # timeout=10
Fetching upstream changes from ssh://yyyyy@gerrit.xxxxxxxx.com:29418/mobile
 > git --version # timeout=10
 > git -c core.askpass=true fetch --tags --progress ssh://yyyyyyy@gerrit.xxxxxxxxx.com:29418/mobile +refs/heads/*:refs/remotes/origin/*
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress ssh://yyyyyy@gerrit.xxxxxxxxx.com:29418/mobile +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
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.

谢谢, 马达夫

1 个答案:

答案 0 :(得分:2)

我认为这是您的.ssh文件夹或id_rsa *文件的权限问题。

请查看本文以设置正确的权限: https://superuser.com/questions/215504/permissions-on-private-key-in-ssh-folder

.ssh文件夹应该存在于jenkins用户的主文件夹中(类似于/ home / jenkins或/ var / lib / jenkins)。

权限应为:

  • .ssh文件夹:700(drwx ------)
  • 公钥(.pub):644(-rw-r - r - )
  • 私钥(id_rsa):600(-rw -------)

请确认修复了您的问题:)

相关问题