【问题标题】:Auto build maven project from a private bitbucket repo and jenkins从私人 bitbucket repo 和 jenkins 自动构建 maven 项目
【发布时间】:2020-03-21 19:12:47
【问题描述】:

我一直致力于使用 Jenkins 自动构建一个 maven 项目。 手动,从 Jenkins 中的“开始构建”开始,它工作正常,但是来自 bitbucket webhook: “jenkins_url/bitbucket-hook/”,在提交并推送我的 bitbucket 存储库后,我进入了 Jenkins 的 Bitbucket Hook 记录此错误:

FATAL: hudson.plugins.git.GitException: Command "git ls-remote -h -- https://my_username@bitbucket.org/repo.git/" returned status code 128:
stdout: 
stderr: remote: Invalid username or password
fatal: Authentication failed for 'https://bitbucket.org/repo.git/'

hudson.plugins.git.GitException: Command "git ls-remote -h -- https://my_username@bitbucket.org/repo.git/" returned status code 128:
stdout: 
stderr: remote: Invalid username or password
fatal: Authentication failed for 'https://bitbucket.org/repo.git/'

我正在使用用户名和密码凭据。

希望你能帮助我。

【问题讨论】:

    标签: maven jenkins bitbucket


    【解决方案1】:

    如果有人需要,我刚刚找到了我自己问题的解决方案。

    只需使用 ssh 访问密钥连接到您的 bitbucket 存储库(不是用户名密码凭据):

    --> 通过su jenkinssu -s /bin/bash jenkins 连接到jenkins 用户

    --> 由ssh-keygen/var/lib/jenkins/.ssh 下生成你的ssh 密钥

    --> 将你的私钥复制到 jenkins 全局标识符中

    --> 将您的公钥复制到 bitbucket 访问密钥中 并且构建将在两种情况下都有效:手动和推送到您的 存储库

    (您还需要 jenkins 中的 ssh 发布者插件来放置 bitbucket 主机 ID)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-12-16
      • 2014-08-16
      • 1970-01-01
      • 2013-02-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多