github:没有可用的受支持的身份验证方法 [英] github: No supported authentication methods available

查看:28
本文介绍了github:没有可用的受支持的身份验证方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 github,过去曾在我的笔记本电脑上成功添加和同步文件.

i use github and have successfully added and synched files on my laptop in the past.

最近我开始在运行后收到PuTTY 致命错误:断开连接:没有可用的支持的身份验证方法":

as of recent i started getting "PuTTY Fatal Error: Disconnected: No supported authentication methods available" after running:

git pull origin master (or push)

git pull origin master (or push)

不过

ssh git@github.com 返回正确响应:错误:您好,用户名!您已成功通过身份验证,但 GitHub 不提供 shell 访问与 github.com 的连接已关闭.

ssh git@github.com returns the correct response: ERROR: Hi username! You've successfully authenticated, but GitHub does not provide shell access Connection to github.com closed.

在 github 上挖掘后,我发现了这个 morcel:

after digging around on github i found this morcel:

没有可用的受支持的身份验证方法您应该注意环境变量 GIT_SSH,如果 ssh 对您不起作用,git 会使用它来查找使用 ssh 的客户端.git install 可能正在使用 plink.exe(通过 GIT_SSH)来执行身份验证.如果是这样,请确保您已运行 pageant.exe,并且您为 github 创建的密钥已加载到其中.这提供了 plink.exe 的密钥;没有它,就会出现上面的错误.

No supported authentication methods available You should be aware of the environment variable GIT_SSH, which is used by git to find your ssh-speaking client, if ssh doesn’t work for you. The git install may be using plink.exe (via GIT_SSH) to perform the authentication. If so, make sure you have pageant.exe running, and the key you created for github loaded into it. This provides the key to plink.exe; without it, the above error will occur.

不确定 plink.exe 或 peagant.exe 是什么......而且 ssh git@github.com 似乎正确验证的事实让我想知道这里的最佳解决方案是什么......我当然不想让我的如果不需要,请设置.

not sure what plink.exe or peagant.exe is.. and the fact that ssh git@github.com seems to authenticate correctly makes me wonder what the best solution here is.. i certainly don't want to overcomplicate my setup if not necessary.

推荐答案

你可以在你的主目录中创建一个名为.profile"的文件,对我来说是 C:Users[user]

You can create a file named ".profile" in your home directory, for me that's C:Users[user]

在该文件中,放入以下代码行:

Inside that file, put the following line of code:

GIT_SSH="/usr/bin/ssh.exe"

这将设置 GIT_SSH 环境变量以使用 git 附带的 ssh 客户端.

This will set the GIT_SSH environment variable to use the ssh client included with git.

.profile 脚本在您启动 Git Bash 命令行时执行.

The .profile script gets executed when you start your Git Bash command line.

这是我的 .profile.它会在您第一次启动 git 命令提示符时询问您的密码,然后会记住它,直到您重新启动计算机.非常方便,因此您不必每次想要做某事时都不断输入密码.

This is my .profile. It will ask you for your password the first time you start the git command prompt, then will remember it from then on, until you reboot your computer. Very handy so you don't have to keep entering your password each time you want to do something.

SSH_ENV="$HOME/.ssh/environment"
GIT_SSH="/usr/bin/ssh.exe"

function start_agent {
echo "Initializing new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}

# Source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
#ps ${SSH_AGENT_PID} doesn't work under cygwin
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi

这篇关于github:没有可用的受支持的身份验证方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆