'git push heroku master' is still asking for authentication

*爱你&永不变心* 提交于 2019-12-17 10:11:13

问题


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://git@heroku.com/appname.git (fetch)
heroku https://git@heroku.com/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.


回答1:


I got around this by logging in with the following :

username : blank

password : heroku auth token

where the auth token can be retrieved by $ heroku auth:token




回答2:


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




回答3:


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 abcd123@gmail.com
     password xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

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




回答4:


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://git@heroku.com/.insteadOf https://git.heroku.com/



回答5:


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




回答6:


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




回答7:


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



回答8:


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.




回答9:


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.




回答10:


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:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git HEAD:master




回答11:


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




回答12:


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




回答13:


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




回答14:


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://git@heroku.com/.insteadOf https://git.heroku.com/



回答15:


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).




回答16:


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.



来源:https://stackoverflow.com/questions/27810419/git-push-heroku-master-is-still-asking-for-authentication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!