Bitbucket 管道无法推送到 heroku

Bitbucket pipeline fail to push to heroku

我确实有一个 react.js 应用程序 (create-react-app) 我按照官方文档中的说明设置了文件,一切顺利,但推送失败了这一特定行

git push https://heroku:$API_KEY@git.heroku.com/$APP_NAME.git HEAD:master

bitbucket-pipelines.yml 在根文件夹中:

image: node:6
clone:
  depth: full
pipelines:
  default:
    - step:
        script:
          - npm install
          - npm test
          - git push git push https://heroku:$API_KEY@git.heroku.com/$APP_NAME.git HEAD:master

我做错了什么? 这里的目标是在 bitbucket 平台上使用 CI,但也将主提交推送到 heroku 存储库以自动部署。

我得到的错误是:

remote: !   WARNING:
remote: !   Do not authenticate with username and password using git.
remote: !   Run `heroku login` to update your credentials, then retry the git command.
remote: !   See documentation for details: https://devcenter.heroku.com/articles/git#http-git-authentication
fatal: Authentication failed for 'https://heroku

首先,确保你的脚本不涉及git push git push https://heroku:.
应该是 git push https://heroku:...

其次,作为 described here,请确保使用 HEROKU_API_KEY,由 heroku authorizations --json(字段“token”)

返回的那个
image: node:6
clone:
  depth: full
pipelines:
  default:
    - step:
        script:
          - npm install
          - npm test
          - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git HEAD:master