I want to deploy my app to heroku and here is my pipeline file
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
I set the HerokuAppkey and herokuappname in enviroment variables, but i've got error
+ git push https://heroku:$HEROKU_API_KEY#git.heroku.com/$HEROKU_APP_NAME.git HEAD:master
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.heroku.com/humolite.git/'
Go to Heroku Account Setting then regenerate api key and replace to $HEROKU_API_KEY.
It appears you've set your account's password to $HEROKU_API_KEY. You need to set a valid token instead.
You can use teh heroku authorizations:create command to create a new token locally. Then, configure your CI to have the right value and your deployment should be working.
Related
I'm seeing this error as of today, was working yesterday and prior to that as well.
Can't see that anything has changed in the Heroku documentation that might cause this breaking change.
Error:
Switched to a new branch 'deploy'
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://git.heroku.com/snapnhd-staging.git/'
main.yml
server-deploy:
needs: server-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#master
- uses: actions/setup-ruby#v1
with:
ruby-version: '2.6.x'
- name: Determine Heroku App
id: heroku
uses: ./.github/actions/heroku-app
- name: Deploy
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
HEROKU_APP: ${{ steps.heroku.outputs.app }}
run: |
git remote add heroku \
https://heroku:$HEROKU_API_KEY#git.heroku.com/$HEROKU_APP.git
git fetch --unshallow origin
git checkout -b deploy
git push heroku deploy:master -f
As part of their response to this ongoing security investigation, Heroku forced all users to reset their passwords on or around May 4 (quoting from an email that, presumably, all customers should have received):
As part of our efforts to enhance our security and in response to an incident published on status.heroku.com, we wanted to inform you that we will begin resetting user account passwords on May 4, 2022.
This also invalidated API tokens:
NOTE: A password reset will also invalidate your API access tokens. As a result, any automations you’ve built to integrate with the Heroku Platform API that use these tokens may result in 403 forbidden errors. To avoid downtime you will need to re-enable direct authorizations by following the instructions here and update your integrations to use your newly generated token.
The linked article shows several ways to generate a new token, all of which boil down to a POST to
https://api.heroku.com/oauth/authorizations
The exact method depends partly on whether you have multi-factor authentication enabled. If you aren't already using MFA, this would be a good time to enable it.
Generate a new token and update your GitHub Actions configuration to use it.
Every time after building and pushing docker image from Gitlab registry to Heroku registry I need to execute heroku container:release web to Heroku run image (release), but I wanna automate this
I added heroku CLI tool installation into gitlab-ci-yml, but I can't auth heroku CLI by token
When I try to set HEROKU_API_KEY=token and run heroku login I get an error Error: Cannot log in with HEROKU_API_KEY set
Also tried to do this with HEROKU_DEBUG on, but debugger info couldn't help me
I can't use ~/.netrc
Any way to auth heroku CLI or automate releasing docker images in heroku?
current gitlab-ci.yml:
before_script:
- apt install snapd
- snap install --classic heroku
- HEROKU_API_KEY=$HEROKU_API_TOKEN heroku login
- docker login -u $REGISTRY_UNAME -p $REGISTRY_PWD registry.gitlab.com
- docker login --username=_ --password=$HEROKU_PWD registry.heroku.com
script:
# a lot of tag & push lines
- heroku container:release web
If you have set the HEROKU_API_KEY environment variable, you don't have to log in again. The API key will be used for the Heroku CLI commands if present.
Make sure to use heroku authorizations:create to create never-expiring tokens. Check this out for a detailed explanation.
Ref: https://github.com/heroku/cli/issues/502#issuecomment-309099883
Note that the git commands like git push heroku master won't use the API key. See this for more info.
problem solved by changing account password that causes tokens changing and re-creating new token
And then run again HEROKU_API_KEY=token heroku container:release web with success
I execute:
> heroku login
and introducing my Heroku username and password, I get:
Logged in as l*********.com
I can execute successfully:
> heroku auth:token
cccc8aa0-aaaa-aaaa-aaaa-bbbb03b38932
after that, I execute:
> git push heroku master
but I get:
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://git.heroku.com/myapp.git/'
What am I doing wrong? It says that I should "not authenticate with username and password using git".. but in that case, what should I do? The docs say:
You cannot authenticate with the Heroku HTTP Git endpoint using your Heroku username (email) and password. Use an API key as described in this section
But it's hard to understand what I should actually do.
I was able to fix it using SSH protocol:
Generate a key: ssh-keygen -t rsa
Upload it to Heroku heroku keys:add
Switching to SSH: git config --global url.ssh://git#heroku.com/.insteadOf https://git.heroku.com/
I am trying to use the Bitbucket Pipelines feature to deploy a node.js project to Heroku. The script(taken from documentation) is:
image: node:6
clone:
depth: full
pipelines:
default:
- step:
script:
- npm install
- git push https://heroku:$HEROKU_API_KEY#git.heroku.com/$HEROKU_APP_NAME.git master
I have set up the enviorment variables for the API key and project name however I am getting the following error:
+ git push https://heroku:$HEROKU_API_KEY#git.heroku.com/$HEROKU_APP_NAME.git master
fatal: remote part of refspec is not a valid name in .git
What am I doing wrong here?
As it turned out when I copied the app_name environment variable I copied it with a trailing space which was the error.
This will work, but in my experience so far the token expires every 8 hours so you'll have to find a different solution.
I'm trying to check a git remote on heroku:
$ heroku auth:logout
Local credentials cleared.
$ heroku auth:login
Enter your Heroku credentials.
Email: ***#gmail.com
Password (typing will be hidden):
Authentication successful.
$ git remote
heroku
origin
$ git remote show heroku
Username for 'https://git.heroku.com':
Password for 'https://git.heroku.com':
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.
fatal: Authentication failed for 'https://git.heroku.com/***-1909.git/'
This error is referenced in the heroku docs, in the screenshot above at https://devcenter.heroku.com/articles/git , but I'm not sure what to do next to fix this.
This is what worked for me.
$ heroku auth:token
Use the result as the password when prompted.
As the warning says, you just need to do:
heroku login
And it will open your browser for logging in, enter details as per your authentication and you will be good to roll in.
I solve this issue no implicit conversion from nil to integer (TypeError) by it by pushing the updates to heroku and when they asked for the user name I added my email and the password it's in this link https://dashboard.heroku.com/account in API KEYS
Username for 'https://git.heroku.com': your email
Password for 'https://email#git.heroku.com': API KEYS
Run this
heroku login
git add .
git commit -m "..."
git push heroku main
This is going to work
After logged with: heroku login
Some access for example on cloning an existing project in your account, is not
allowed using git native even stay you logged in, and only using git from heroku, such as:
heroku git:[command]
an example clonning a repository:
heroku git:clone -a [app_name]
Otherwise, sometimes, after logged with heroku login, you can check your remote git with: git remote -v
Other way, is you use heroku auth:token and use their output as password, of course, run it after logged.