'git push heroku master' is still asking for authentication
Asked Answered
K

21

90

I have executed:

$ heroku login

But when I try to push, I'm still asked for authentication:

$ git push heroku master
Username for 'https://git.heroku.com': <email>
Password for 'https://<email>@git.heroku.com':

Then I get a WARNING: Do not authenticate with username and password using Git.

I ran heroku login again and authenticated successfully but I still get the same failure.

I've checked the remote:

$ git remote -v
heroku https://[email protected]/appname.git (fetch)
heroku https://[email protected]/appname.git (push)

I've also generated a new public key, passed it to Heroku, and validated it: https://devcenter.heroku.com/articles/keys

I am on Windows 8, with Git 1.9.5.

Kaylil answered 7/1, 2015 at 2:11 Comment(4)
How does your ssh config look? Have you added the host entry?Bicephalous
I've fixed the problem in the config file, as answered here: #16721928 :/Kaylil
Maybe my comment only can help few people, but I found that this error also occurs if your name of account(Windows account) consists of non-ASCII. I hope that this comment can help someone!Kurtiskurtosis
Get the heroku cmd, run heroku login.Pyjamas
K
1

Pardon for the late reply, but I have fixed my problem two months ago. (Just haven't marked the question as answered. /noob)

SSH Fingerprint not authorized on Heroku after git restore

Kaylil answered 16/3, 2015 at 4:13 Comment(0)
S
216

I got around this by logging in with the following :

username : email used to register to heroku (Also been able to leave this field blank)

password : heroku auth token (API Key)

where the auth token can be retrieved by $ heroku auth:token or via the Account Settings in Heroku

Scummy answered 4/2, 2015 at 21:19 Comment(9)
and by blank - you actually mean 'blank' in the username.Monge
well, when I try "nothing" it says invalid entry. When I typed in "blank" it worked. This is on a windows system.Monge
@NunoFurtado, however I've answered my problem with the answer here: #16721928Kaylil
Worked for me! You can also get the auth key in dashboard.heroku.com/account -> API KeyAbran
although this made absolutely no sense to me, it did in fact work. magic.Janis
Works like magic. I did heroku login and logged in, then checked out. When asked again for user name and password got the passord from website. Its called now API keyPasadena
worked indeed, but I had to put my email as login... so here's another data point for you :)Folio
For me email didn't work, blank username did. Thanks.Nonproductive
To generate long-term token I used this: heroku authorizations:createBurlie
K
29

I had the same problem (git couldn't authenticate). It happend that GIT wants to read auth data from %HOME%/_netrc file and on Windows you don't have this variable (only %USERPROFILE% and %HOMEDRIVE% + %HOMEPATH%)

i set HOME to %USERPROFILE% (the place where heroku saved _netrc file) and GIT started working

Kenlay answered 15/4, 2015 at 13:56 Comment(2)
Where do you get %USERPROFILE%? I have also tried to set %HOME% to an absolute path but all I get is untracked _netrc file. Does not work for me.Auditorium
i'm setting HOME=c:\users\razor and it's a place of _netrc file c:\users\razor\_netrc Heroku createdKenlay
F
18

First find the _netrc file that is created by heroku. In windows it can be found in C:\Users\User Name\_netrc.

That file contains credentials for git.heroku.com

machine git.heroku.com
     login [email protected]
     password xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Use that login and password when ask for authentication after $ git push heroku master command

Fin answered 17/4, 2016 at 8:54 Comment(2)
Nice! Thank you!Alien
Works like a charm.Trousseau
T
18

Username: the email you used for registering to Heroku
Password: the API key which Heroku provides you with, in your Account Settings on Heroku website

This worked for me

Tarra answered 17/3, 2018 at 6:28 Comment(1)
here https://dashboard.heroku.com/account. Roll down the screen and hit the reveal button.. Thanks @TarraKella
F
15

From the Heroku documentation

Enter the following commands:

# Enable SSH authentication
$ heroku create --ssh-git

# Redirect tall HTTPS calls to SSH
$ git config --global url.ssh://[email protected]/.insteadOf https://git.heroku.com/
Fetus answered 21/3, 2016 at 0:56 Comment(0)
N
8

I have exactly the same problem. The reason in my case, I used accidentally window console instead of Git bash

Nasopharynx answered 26/3, 2015 at 3:10 Comment(5)
Goes to show how there could be a lot of reasons behind one warning.Kaylil
i dont see how this could cause the issue, actually I think I used windows cmd...Scummy
ffs, you're supposed to use the Git bash?Systematics
I get another error after I use Git bash. Maybe I'll stick to cmdAuditorium
You should be able to use either. Or both. It just depends on whether or not you have your context set up with the proper heroku credentials.Alow
B
6

If someone is still struggling with this, this answer helped me a lot Use Heroku API key.

First, as @Raziza O mentioned in a comment, to get heroku API key

https://dashboard.heroku.com/account. Roll down the screen and hit the reveal button.

Then, just run git push https://heroku:[email protected]/$HEROKU_APP_NAME.git HEAD:master

Bevin answered 13/4, 2019 at 5:57 Comment(1)
this is the wayRegionalism
B
5

Renaming the _netrc file to .netrc on Windows 7 in the userdir worked for me.

..after trying all the steps in many other tutorials.

Run the 3rd command in cmd in your userdir or the whole combo:

setx HOME %USERPROFILE%
cd %HOME%
REN _netrc .netrc
Blackmarketeer answered 13/8, 2015 at 13:19 Comment(1)
In my case I did the login through a windows cmd prompt and wanted to use the credentials in Cygwin. Renaming the file .netrc in my home folder made git recognize itTheatrician
T
3

To generate a long term heroku token use:

heroku authorizations:create

Sample Output:

Creating OAuth Authorization... done
Client:      <none>
ID:          XXXXXXXX-XXXX-4c9c-85f2-554f0f0c14fa
Description: Long-lived user authorization
Scope:       global
Token:       XXXXXXXX-XXXX-4ad5-ac64-44bbc01c2d95
Updated at:  Wed Mar 04 2020 12:00:00 GMT+0000 (Greenwich Mean Time) (less than a minute ago)

Then use the following info for git:

username: blank (type the word blank)
pass: XXXXXXXX-XXXX-4ad5-ac64-44bbc01c2d95
Teletype answered 4/3, 2020 at 12:4 Comment(0)
S
3

For me it happened in 2 scenarios: when using in the first time or when it goes a long time without using git and it automatically logs out.

In both cases you just need to run heroku login and it will open the browser in order you can start a new session.

Silkworm answered 23/3, 2022 at 22:12 Comment(0)
I
2

Simply write: $heroku login
It will take you to the web login. Enter your credentials there, and you will be logged in via CLI as well.

Interested answered 21/2, 2020 at 16:30 Comment(0)
K
1

Pardon for the late reply, but I have fixed my problem two months ago. (Just haven't marked the question as answered. /noob)

SSH Fingerprint not authorized on Heroku after git restore

Kaylil answered 16/3, 2015 at 4:13 Comment(0)
C
1

This happens because git and heroku aren't using the same _netrc file. This is something I'm trying to fix, but you can help me out by finding where your _netrc file should be and where the CLI is putting it.

The following will output potential sources of where the _netrc file could be:

> echo %HOME%
> echo %HOMEDRIVE%%HOMEPATH%
> echo %USERPROFILE%

You could try to add the _netrc file into one of them to find the one that matches. Let me know which has the _netrc file, and where you are able to put it and have git pick it up by not asking you for the username/password.

Also check your .gitconfig to see if there are any git credential helpers, that may be causing an issue.

Carner answered 7/4, 2015 at 18:51 Comment(0)
D
1

If anybody else is trying to solve this on cygwin: http://www.railszilla.com/git-push-heroku-master-authentication/start rewriting to SSH transport did the trick for me:

git config --global url.ssh://[email protected]/.insteadOf https://git.heroku.com/
Doubleganger answered 20/8, 2017 at 4:49 Comment(0)
B
1

You have probably logged into heroku in two terminals, and if you try to run a command on first terminal, it will report such error, as new authentication was made in the second terminal.

Either login again with heroku login and run commands in that terminal, or run commands in that second window (if you have it still open).

Basketwork answered 8/12, 2017 at 12:17 Comment(1)
This solution (heroku login) worked for me, though possibly for a different reason.Hankering
T
1

This topic is old, I know.

However, none of the previous solutions worked for me.

My problem was that "Windows Credentials" (os: Windows 10) had another credential previously associated with Heroku (company account) and used this instead of the new one (my personal account).

I had to go to: "Control Panel\All Control Panel Items\Credential Manager" (from Control Panel), and modify all the credentials: https://git.heroku.com (and all those associated with "heroku" word) with the account current.

However, the password I placed the Key API that is displayed in "Dashboard" of the site and the command works: git push heroku master.

7 hours that life will not give me back. :/

My 2 cents.

Tineid answered 20/7, 2018 at 5:32 Comment(0)
B
0

What I did was open git bash instead of command prompt and type "git push heroku master". It worked :D

Banyan answered 6/6, 2015 at 2:2 Comment(0)
E
0

I fixed this by changing the http address to ssh://git@heroku/...

Expose answered 7/11, 2016 at 3:55 Comment(0)
D
0

I had the same problem on windows and get it sorted just using the PSW available on the on _netrc file it can be found in C:\Users\User Name_netrc.

I hope it can help.

Dardar answered 18/8, 2019 at 17:5 Comment(0)
S
0

It was possible to log in using Heroku API Key (Account Settings -> API Key) as mentioned by @andy mccullough, however, logging in was needed every time.

git fetch

resolved the issue in my case.

Sappy answered 3/9, 2020 at 11:30 Comment(0)
R
0

Just use heroku login per Git message.

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

This should redirect you to the browser and bring up the Heroku Login page or in some cases actually just log you in using your credentials.

Rhizotomy answered 2/7, 2023 at 16:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.