【问题标题】:Push to private bitbucket repo from pipelines从管道推送到私有 bitbucket 存储库
【发布时间】:2018-10-24 15:06:18
【问题描述】:

我正在尝试从 bitbucket 管道提交并推送到 bitbucket 存储库。但是,它是一个私人仓库,那么访问它的最简单方法是什么?

这是我的脚本的样子:

pipelines:
  default:
    - step:
        script: # Modify the commands below to build your repository.
          - VERSION=$(<version.txt)
          - echo $VERSION 0.1 | awk '{print $1 + $2}' > version.txt
          - echo $(<version.txt)
          - git config --global push.default simple
          - git remote set-url origin https://myname@bitbucket.org/company/repo.git
          - git config user.name "myname"
          - git config user.email "myname@company.com"
          - git add version.txt
          - git commit -m "[skip CI]"
          - git push
          - echo "New version = $VERSION"

它卡在 push 命令并返回:

fatal: could not read Password for 'https://myname@bitbucket.org': No such device or address

我如何设置我的密码,或者有没有没有密码的方法?让它以某种方式意识到它已经在回购本身中。我阅读了有关 SSH 密钥的信息,但对这个概念以及如何使用它们不是很熟悉。

【问题讨论】:

    标签: git bitbucket push bitbucket-pipelines


    【解决方案1】:

    使用名为BB_AUTH_STRING 之类的安全环境变量,并为其指定值username:password。 (使用应用密码执行此操作是最安全的,因为这些密码仅适用于您提供的范围。)这也会将您的远程 URL 更改为 https://${BB_AUTH_STRING}@bitbucket.org/owner/repo.git

    【讨论】:

      猜你喜欢
      • 2014-10-23
      • 2017-05-21
      • 1970-01-01
      • 2019-03-18
      • 1970-01-01
      • 2017-01-04
      • 1970-01-01
      • 1970-01-01
      • 2017-06-29
      相关资源
      最近更新 更多