【发布时间】:2019-03-31 16:03:59
【问题描述】:
我可以在托管 Jenkins 应用程序的 Linux 服务器上克隆我的 git 存储库,但是当我尝试创建一个新的 Jenkins 作业来执行此操作时,我收到错误 128。
“无法连接到存储库:命令“git ls-remote -h ssh://git@bitbucket.org/user/proj.git HEAD”返回状态码 128: 标准输出: 标准错误:权限被拒绝(公钥)。 致命:无法从远程存储库读取。
请确保您拥有正确的访问权限 并且存储库存在。”
我做过的事情
在 Linux 服务器上安装 git。
安装 BitBucket 插件及其对 Jenkins 应用的依赖项。
创建 SSH 密钥。
- 将密钥导入 BitBucket 和 Jenkins 文件夹。
- 为 Jenkins 用户设置 SSH 密钥的权限。
- 我在 Jenkins 应用上创建了 SSH 凭据。
在终端上工作
bash-4.2$
bash-4.2$ whoami
jenkins
bash-4.2$ ssh -T git@bitbucket.org
authenticated via a deploy key.
You can use git or hg to connect to Bitbucket. Shell access is disabled.
This deploy key has read access to the following repositories:
user/proj: test3 -- jenkins@git
.
.
git -c core.askpass=true ls-remote -h ssh://git@bitbucket.org/user/proj.git
[ec2-user@ip-172-31-31-13 ~]$ git -c core.askpass=true ls-remote -h ssh://git@bitbucket.org/user/proj.git
db710fbf01f08789cf5c15e66269013f8e1543d4 refs/heads/master
图片:
2-ssh 2 git using default user
【问题讨论】:
标签: git jenkins bitbucket permission-denied public-key