Jenkins 无法连接到存储库
Jenkins Failed to Connect to Repository
我正在尝试将 Jenkins 连接到私有 BitBucket 存储库。
我有一组(id_rsa 和 id_rsa.pub)在 /var/lib/jenkins/.ssh
生成的 SSH 密钥。我复制了 id_rsa.pub
密钥并将其粘贴到我的 BitBucket 存储库的部署密钥部分。类似地,运行 命令 git ls-remote -h git@bitbucket.org:user/project.git
具有有效的 return 并已添加到 known_hosts
。
什么可能导致我的 Jenkins 无法连接到 Jenkins 的 git 源代码管理部分?错误 returned 是:
Failed to connect to repository : Command "git -c core.askpass=true ls-remote -h https://git@bitbucket.org/user/project.git HEAD" returned status code 128:
stdout:
stderr: remote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in your account profile.
fatal: Authentication failed for 'https://git@bitbucket.org/user/project.git/'
我还根据 Atlassian 的 this doc 尝试了 ssh -Tv git@bitbucket.org
以解决 SSH 问题。 return 指出:
This deploy key has read access to the following repositories:
user/project: Jenkins -- jenkins@ip-xxx-xx-xx-xxx
对于 Jenkins 的 Git Plugin 提供的 Project Repository 字段,他们的主页中显示的该字段的示例之一(具体来说,https://git@bitbucket.org/user/project.git
)似乎不起作用。这可能是插件版本的情况,或者 BitBucket 的配置方式可能与 GitHub 不同,他们的文档使用了这些示例。
然而,对我有用的是使用以下格式的 git 地址:
git@bitbucket.org:user/project.git
我正在尝试将 Jenkins 连接到私有 BitBucket 存储库。
我有一组(id_rsa 和 id_rsa.pub)在 /var/lib/jenkins/.ssh
生成的 SSH 密钥。我复制了 id_rsa.pub
密钥并将其粘贴到我的 BitBucket 存储库的部署密钥部分。类似地,运行 命令 git ls-remote -h git@bitbucket.org:user/project.git
具有有效的 return 并已添加到 known_hosts
。
什么可能导致我的 Jenkins 无法连接到 Jenkins 的 git 源代码管理部分?错误 returned 是:
Failed to connect to repository : Command "git -c core.askpass=true ls-remote -h https://git@bitbucket.org/user/project.git HEAD" returned status code 128: stdout: stderr: remote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in your account profile. fatal: Authentication failed for 'https://git@bitbucket.org/user/project.git/'
我还根据 Atlassian 的 this doc 尝试了 ssh -Tv git@bitbucket.org
以解决 SSH 问题。 return 指出:
This deploy key has read access to the following repositories:
user/project: Jenkins -- jenkins@ip-xxx-xx-xx-xxx
对于 Jenkins 的 Git Plugin 提供的 Project Repository 字段,他们的主页中显示的该字段的示例之一(具体来说,https://git@bitbucket.org/user/project.git
)似乎不起作用。这可能是插件版本的情况,或者 BitBucket 的配置方式可能与 GitHub 不同,他们的文档使用了这些示例。
然而,对我有用的是使用以下格式的 git 地址:
git@bitbucket.org:user/project.git