'git push heroku master' 仍在要求身份验证

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27810419/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 02:47:37  来源:igfitidea点击:

'git push heroku master' is still asking for authentication

gitauthenticationherokuheroku-toolbelt

提问by Rea G

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.

然后我收到一个警告:不要使用 Git 使用用户名和密码进行身份验证。

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

我再次运行 heroku login 并成功通过身份验证,但我仍然遇到同样的失败。

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

我还生成了一个新的公钥,将其传递给 Heroku,并对其进行了验证:https: //devcenter.heroku.com/articles/keys

I am on Windows 8, with Git 1.9.5.

我在 Windows 8 上,使用 Git 1.9.5。

采纳答案by Rea G

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

请原谅我回复晚了,但我两个月前已经解决了我的问题。(只是没有将问题标记为已回答。/noob)

SSH Fingerprint not authorized on Heroku after git restore

git restore 后 SSH 指纹未在 Heroku 上授权

回答by andy mccullough

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)

用户名:用于注册到 heroku 的电子邮件(也可以将此字段留空

password : heroku auth token(API Key)

密码:heroku 身份验证令牌API 密钥

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

可以$ heroku auth:token通过 Heroku 中的帐户设置或通过 Heroku 中的帐户设置检索身份验证令牌

回答by razor

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

我遇到了同样的问题(git 无法进行身份验证)。碰巧 GIT 想要从 %HOME%/_netrc 文件中读取身份验证数据,而在 Windows 上你没有这个变量(只有 %USERPROFILE% 和 %HOMEDRIVE% + %HOMEPATH%)

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

我将 HOME 设置为 %USERPROFILE%(heroku 保存 _netrc 文件的地方)并且 GIT 开始工作

回答by e11438

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

首先找到_netrcheroku创建的文件。在 Windows 中,它可以在C:\Users\User Name\_netrc.

That file contains credentials for git.heroku.com

该文件包含以下凭据 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 mastercommand

$ git push heroku master命令后要求身份验证时使用该登录名和密码

回答by Rebs

From the Heroku documentation

来自Heroku 文档

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/

回答by Sarah

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

用户名:您用于注册 Heroku 的电子邮件
密码:Heroku 为您提供的 API 密钥,位于 Heroku 网站的“帐户设置”中

This worked for me

这对我有用

回答by jlcj

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

我有完全一样的问题。就我而言,原因是我不小心使用了窗口控制台而不是 Git bash

回答by Qwerty

Renaming the _netrcfile to .netrcon Windows 7 in the userdir worked for me.

在用户_netrc目录中将文件重命名为.netrcWindows 7 对我有用。

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

..在尝试了许多其他教程中的所有步骤之后。

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

在用户目录或整个组合中的 cmd 中运行第三个命令:

setx HOME %USERPROFILE%
cd %HOME%
REN _netrc .netrc

回答by Mohamed Rozza

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

如果有人仍在为此苦苦挣扎,这个答案对我有很大帮助Use Heroku API key

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

首先,正如@Raziza O在评论中提到的,获取 heroku API 密钥

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

https://dashboard.heroku.com/account。向下滚动屏幕并点击显示按钮。

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

然后,只需运行 git push https://heroku:[email protected]/$HEROKU_APP_NAME.git HEAD:master

回答by Martin

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

如果其他人试图在 cygwin 上解决这个问题:http: //www.railszilla.com/git-push-heroku-master-authentication/startrewriting to SSH transport 对我来说是个窍门:

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

回答by Jeff Dickey

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

发生这种情况是因为 git 和 heroku 没有使用相同的_netrc文件。这是我正在尝试解决的问题,但您可以通过查找_netrc文件应在的位置以及 CLI 将其放置的位置来帮助我。

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

以下将输出_netrc文件所在位置的潜在来源:

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

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

您可以尝试将_netrc文件添加到其中之一以找到匹配的文件。让我知道哪个拥有该_netrc文件,以及您可以将它放在哪里并让 git 通过不要求您提供用户名/密码来获取它。

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

还要检查您.gitconfig是否有任何 git 凭证助手,这可能会导致问题。