在 git pull origin [branch] 上提示输入密码

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7574459/
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-19 06:02:05  来源:igfitidea点击:

Prompted for password on git pull origin [branch]

gitgithubssh-keys

提问by Brendon

When I attempt to git pull origin [branch] in order to pull in changes to the repo, I am prompted for a password. My system password and just hitting enter return: "fatal: Authentication failed".

当我尝试 git pull origin [branch] 以拉入对 repo 的更改时,系统会提示我输入密码。我的系统密码并按回车键返回:“致命:身份验证失败”。

The thing is, I never entered a password for this project in the past and this was not the case when I began it last week, nor any of the times I pushed and pulled since then. Speaking to my client, they thought it was something with my SSH keys.

问题是,我过去从未为这个项目输入过密码,上周开始时也不是这种情况,从那以后我推拉的任何一次都不是。与我的客户交谈时,他们认为这与我的 SSH 密钥有关。

I double checked the keys and made sure they were correct, running ssh [email protected]. I'm getting:

我再次检查了密钥并确保它们是正确的,运行 ssh [email protected]。我越来越:

Hi bdkay! You've successfully authenticated, but GitHub does not provide shell access. Connection to github.com closed.

你好!您已成功通过身份验证,但 GitHub 不提供 shell 访问。与 github.com 的连接已关闭。

which makes me think it succeeded. However, right before that a troublesome line reading: "PTY allocation request failed on channel 0" occurs. The client says I'm still added to the repo in github and they have not changed anything on their end. I'm still working on the same machine but cannot seem to find a fix through google or searching this site. Any help is greatly appreciated.

这让我觉得它成功了。然而,就在此之前,出现了一个麻烦的行:“通道 0 上的 PTY 分配请求失败”。客户说我仍然被添加到 github 的 repo 中,他们最终没有改变任何东西。我仍在同一台机器上工作,但似乎无法通过谷歌或搜索此站点找到修复程序。任何帮助是极大的赞赏。

回答by Tekkub

If you're being prompted for a password, and not your SSH key's passphrase, then you're not using the SSH URL. HTTPS asks for user/pass auth, SSH uses key/passphrase. Check your remote's URL with git remote -v, and if you need to fix it use git remote set-url.

如果系统提示您输入密码,而不是 SSH 密钥的密码,那么您没有使用 SSH URL。HTTPS 要求用户/密码验证,SSH 使用密钥/密码。使用 来检查遥控器的 URL git remote -v,如果需要修复它,请使用git remote set-url.