Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jenkins无法连接到存储库_Jenkins_Ssh_Bitbucket - Fatal编程技术网

Jenkins无法连接到存储库

Jenkins无法连接到存储库,jenkins,ssh,bitbucket,Jenkins,Ssh,Bitbucket,我正在尝试将Jenkins连接到私人BitBucket存储库 我在/var/lib/jenkins/.SSH上生成了一组SSH密钥(id\u rsa和id\u rsa.pub)。我已经复制了id_rsa.pub密钥,并将其粘贴到我的BitBucket存储库的部署密钥部分。类似地,运行命令gitlsremote-hgit@bitbucket.org:user/project.git具有有效的返回值,并且已添加到已知的\u主机 是什么导致我的Jenkins在Jenkins的git源代码管理部分无法连

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

我在
/var/lib/jenkins/.SSH
上生成了一组SSH密钥(id\u rsa和id\u rsa.pub)。我已经复制了
id_rsa.pub
密钥,并将其粘贴到我的BitBucket存储库的部署密钥部分。类似地,运行命令
gitlsremote-hgit@bitbucket.org:user/project.git
具有有效的返回值,并且已添加到
已知的\u主机

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

无法连接到存储库:命令“git-c core.askpass=true ls remote-h HEAD”返回状态代码128: 标准: stderr:remote:无效的用户名或密码。如果您通过第三方服务登录,您必须确保在您的帐户配置文件中设置了帐户密码。 致命:验证“”失败

我还尝试了
ssh-Tvgit@bitbucket.org
根据Atlassian关于SSH问题的疑难解答。返回的状态为:

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

用户/项目:詹金斯--jenkins@ip-xxx xx xx xxx


对于Jenkins提供的Project Repository字段,他们的一个示例似乎显示在该字段的主页上(具体来说,
https://git@bitbucket.org/user/project.git
)不起作用。这可能是插件版本的情况,也可能是BitBucket的配置与GitHub不同的情况,他们的文档使用GitHub作为示例

然而,对我来说有效的是使用以下格式的git地址:

git@bitbucket.org:user/project.git

所以我犯了一个愚蠢的错误,使用了
https://git@bitbucket.org/user/project.git
而不是
git@bitbucket.org:user/project.git
facepalm将其更改为后者可以工作,无需填写凭据(假设SSH已成功设置)。请,将您的评论添加为解决方案,并将其标记为已解决:)您应该将其添加为anser@Xenyal。我在GitHub.JoSSI和@angryip上犯了同样的错误,谢谢你提起这个。我已将其添加为可接受的解决方案。