Search code examples
windowsgitherokuheroku-cli

Heroku push failed in Windows + Git bash


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.


Solution

  • I was able to fix it using SSH protocol:

    1. Generate a key: ssh-keygen -t rsa

    2. Upload it to Heroku heroku keys:add

    3. Switching to SSH: git config --global url.ssh://[email protected]/.insteadOf https://git.heroku.com/