I do have a react.js app (create-react-app) I setup the file just like explained in the official docs, everything went good but the push failed with this specific line
git push https://heroku:$API_KEY@git.heroku.com/$APP_NAME.git HEAD:master
The bitbucket-pipelines.yml is on the root folder:
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
What I'm doing wrong? The goal here is to use the CI on bitbucket platform but also push master commits to heroku repository to automate deploys.
The error I'm getting is:
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
2018: First, make sure your script does not involve git push git push https://heroku:
.
It should be git push https://heroku:
...
Second, as described here, make sure to use your HEROKU_API_KEY, the one returned by heroku authorizations --json
(field "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
2024: as noted by Raul Rene in the comments:
Heroku no longer supports pushing code via credentials (since Jan. 2023):
"Username and password authentication for Heroku API is now deprecated".