Jenkins无法连接到存储库

时间:2016-04-04 13:13:06

标签: jenkins ssh bitbucket

我正在尝试将Jenkins连接到私有BitBucket存储库。

我在/var/lib/jenkins/.ssh生成了一个SSH密钥集(包括id_rsa和id_rsa.pub)。我已经复制了id_rsa.pub密钥并将其粘贴到我的BitBucket存储库的deploy keys部分。同样,运行命令git ls-remote -h git@bitbucket.org:user/project.git具有有效的返回值,并已添加到known_hosts

什么可能导致我的Jenkins无法连接Jenkins的git源代码管理部分?返回的错误是:

  

无法连接到存储库:命令" git -c core.askpass = true ls-remote -h https://git@bitbucket.org/user/project.git HEAD"返回状态码128:   标准输出:   stderr:remote:用户名或密码无效。如果您通过第三方服务登录,则必须确保在帐户配置文件中设置了帐户密码。   致命:' https://git@bitbucket.org/user/project.git/'

的身份验证失败

我还根据Atlassian的this doc尝试ssh -Tv git@bitbucket.org解决SSH问题。回报表明:

  

此部署密钥具有对以下存储库的读访问权:

     

用户/项目:Jenkins - jenkins @ ip-xxx-xx-xx-xxx

1 个答案:

答案 0 :(得分:1)

对于詹金斯(Jenkins)的Git Plugin提供的“项目存储库”字段,似乎在其主页上显示的该字段之一(特别是https://git@bitbucket.org/user/project.git)无效。可能是插件版本的情况,还是BitBucket的配置方式与GitHub有所不同,其文档均以GitHub为例。

但是对我有用的是使用以下格式的git地址:

git@bitbucket.org:user/project.git