我有类似的问题,直到我得到它的工作。以下是集成的完整列表:
- 生成公钥/私钥对:
ssh-keygen -t rsa
复制公钥 (~/.ssh/id_rsa.pub) 并将其粘贴到用户帐户管理控制台中的 Bitbucket SSH 密钥中:

使用私钥凭据将私钥(~/.ssh/id_rsa)复制到新用户(甚至现有用户),在这种情况下,用户名不会有任何影响,所以用户名可以是任何东西:

运行此命令以测试您是否可以访问 Bitbucket 帐户:
ssh -T git@bitbucket.org
- 可选:现在,您可以使用 git 将 repo 复制到您的办公桌,而无需密码
git clone git@bitbucket.org:username/repo_name.git
现在您可以为 Jenkins 推送通知和自动构建启用 Bitbucket 挂钩,您将分两步完成:
在您配置的作业/项目中添加一个身份验证令牌,它可以是任何东西:

在 Bitbucket hooks 中:选择 jenkins hooks,并填写如下字段:

在哪里:
**End point**: username:usertoken@jenkins_domain_or_ip
**Project name**: is the name of job you created on Jenkins
**Token**: Is the authorization token you added in the above steps in your Jenkins' job/project
Recommendation: I usually add the usertoken as the authorization Token (in both Jenkins Auth Token job configuration and Bitbucket hooks), making them one variable to ease things on myself.