繁体   English   中英

Jenkins:无法连接到Bitbucket Git存储库

[英]Jenkins: unable to connect to bitbucket git repository

我正在尝试将詹金斯连接到bitbucket git存储库。

当我在jenkins中指定存储库URL时,它将返回以下错误消息:

Failed to connect to repository : 
Command "git ls-remote -h <SSH_Git_url> 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.

我已经使用Git Bash成功运行了上面的命令(运行jenkins的地方),并且known_hosts文件具有正确的主机地址和端口。

在运行上述命令之前,我还使用了set git_ssh_command="ssh -i <ActualPathToPrivateKey>" ,以检查是否有帮助。

其他一些要点(不确定是否增加了这个问题,而是尝试提供尽可能多的信息):

a. The public\private keys were created using the `ssh-keygen` command in the c:\users\<UserName>\.ssh folder. 
b. The public key was copied and added as a read\write access key for the repository in bitbucket.
c. Jenkins runs as a windows service and logs on as a "Local service account".

我可能做错了什么?

更新:12/11/2018:

git版本是2.17.1.windows.2。

我尝试了@VonC建议的选项,但出现以下相同错误。 在配置单个作业=>凭据下拉列表中,没有任何显示。

在此处输入图片说明

在此处输入图片说明

Jenkins作为Windows服务运行,并以“本地服务帐户”登录

这意味着在进行测试时,它可能无法访问与您帐户相同的环境变量。
确保在SSH凭据插件中注册ssh密钥。

并检查您的Git版本:如果是2.19.2,则ssh-keygen命令已更改生成的密钥格式(从PEM更改为openssh):请参阅“ Jenkins:凭据中私钥的正确格式是什么 ”。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM