Jenkins:无法连接到存储库 [英] Jenkins: Failed to connect to repository

查看:696
本文介绍了Jenkins:无法连接到存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当我指定Repo URL时,jenkins会返回以下错误消息:


无法连接到存储库:命令git ls-remote -h git@github.com:adolfosrs / jenkins-test.git HEAD返回状态码128:
stdout:
stderr:主机密钥验证失败。
致命:无法从远程存储库读取。
请确保您拥有正确的访问权限
并存在存储库。


使用HTTPS时: // url:jenkins返回:


无法连接到资源库:无法连接到
https://github.com/adolfosrs/jenkins-test.git (status = 407)

我可以在jenkins运行的同一台机器上成功克隆repo,并且还运行 git ls-remote -h git @ github .com:adolfosrs / jenkins-test.git HEAD 命令。所以我在github上有了正确的SSH。

解决方案

问题在于,我用root用户创建了ssh文件。
所以文件所有者是root。

解决方案只是将所有权更改为jenkins用户。

  chown jenkins id_rsa.pub 
chown jenkins id_rsa


I'm trying to connect jenkins on a github repo.

When I specify the Repo URL jenkins return the following error message:

Failed to connect to repository : Command "git ls-remote -h git@github.com:adolfosrs/jenkins-test.git 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.

When using the HTTPS:// Url jenkins returns:

Failed to connect to repository : Failed to connect to https://github.com/adolfosrs/jenkins-test.git (status = 407)

I could successfully clone the repo at the same machine where jenkins is running and I also run the git ls-remote -h git@github.com:adolfosrs/jenkins-test.git HEAD command. So I have the right SSH at github.

解决方案

The problem was that somehow I created the ssh files with the root user. So the files owner was root.

The solution was just change the ownership to the jenkins user.

chown jenkins id_rsa.pub 
chown jenkins id_rsa

这篇关于Jenkins:无法连接到存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆