git push origin master:错误:断开连接:没有可用的受支持的身份验证方法

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

git push origin master: ERROR: Disconnected: No supported authentication methods available

gitgithub

提问by Clergyman

I have read the GitHub questions here rather thoroughly, but couldn't find the clue to my problem. I have created new git repo and now I'm trying to push it to GitHub:

我在这里相当彻底地阅读了 GitHub 问题,但找不到我的问题的线索。我已经创建了新的 git repo,现在我正在尝试将它推送到 GitHub:

git remote add origin [email protected]:clergyman/first_app.git
git push origin master

I get:

我得到:

FATAL ERROR: Disconnected: No supported authentication methods available
fatal: The remote end hung up unexpectedly

ssh [email protected]works fine.
I'm running on 32 bits windows 7.
GitHub global settings are fine too. Any ideas?

ssh [email protected]工作正常。
我在 32 位 Windows 7
上运行。GitHub 全局设置也很好。有任何想法吗?

采纳答案by Clergyman

The solution is somehow change default ssh client for git from pegeant to openSsh. E.g. reinstall git and check openSSH in the corresponding window (not pegeant or something), if you have just installed git and haven't started to work woth it yet.

解决方案是以某种方式将 git 的默认 ssh 客户端从 pegeant 更改为 openSsh。例如,如果您刚刚安装了 git 并且还没有开始使用它,则重新安装 git 并在相应的窗口中检查 openSSH(不是 pegeant 或其他东西)。

回答by kemida

I ran into the same error message trying to get Git, Git Extensions, and GitHub working with 64-bit Windows 7. I was able to solve the problem while continuing to use Putty.

我在尝试让 Git、Git Extensions 和 GitHub 与 64 位 Windows 7 一起工作时遇到了相同的错误消息。我能够在继续使用 Putty 的同时解决问题。

I created a .profilefile in C:\Users\MyUserNamewith the following contents:

我在C:\Users\MyUserName 中创建了一个.profile文件,内容如下:

GIT_SSH="/c/Program Files (x86)/Git/bin/ssh.exe"

Had to use "touch .profile" within git bash to create the file since Windows GUI chastises you for trying to create files starting with period.

必须在 git bash 中使用“touch .profile”来创建文件,因为 Windows GUI 会责备您尝试创建以句点开头的文件。

Can't take credit. I just put a windows spin on the answer provided here.

不能相信。我只是对这里提供的答案进行了调整。

回答by Mr. HA

When I choose plink.exe to perform the authentication, Here are my steps

当我选择 plink.exe 执行身份验证时,这是我的步骤

  1. use "puttygen.exe" to generate the public and private keys and save the private key in putty private key file format( filename.ppk ).
  2. Paste the public key generated in "puttygen.exe" into github account setting.
  3. Launch pageant.exe (Putty Authentication Agent) , and add the private key generated in step 1.
  1. 使用“puttygen.exe”生成公钥和私钥,并将私钥保存为putty私钥文件格式(filename.ppk)。
  2. 将“puttygen.exe”中生成的公钥粘贴到github账号设置中。
  3. 启动 pageant.exe (Putty Authentication Agent) ,并添加步骤 1 中生成的私钥。

回答by VonC

Could the section "No supported authentication methods available" on GitHubhelp at all?

GitHub 上的“没有可用的支持的身份验证方法”部分是否有帮助?

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.exerunning, and the key you created for github loaded into it. This provides the key to plink.exe; without it, the above error will occur.

See this postfor a longer discussion.

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

有关更长的讨论,请参阅此帖子

回答by James Lawruk

My co-worker have this error crop up on him today using TortoiseGit. He had inadvertently moved his Putty Private Key file (myprivatekey.ppk) into a different folder. So ensure the path to your private key file is correct. In TortoiseGit, go to Settings...Git...Remote. See the screenshot below:

我的同事今天在使用 TortoiseGit 时遇到了这个错误。他无意中将他的 Putty 私钥文件 (myprivatekey.ppk) 移动到了另一个文件夹中。因此,请确保您的私钥文件的路径正确。在 TortoiseGit 中,转到Settings...Git...Remote。请看下面的截图:

enter image description here

在此处输入图片说明

回答by jkeesh

Have you properly set up your ssh keys on github?

您是否在 github 上正确设置了 ssh 密钥?

You need to create a ssh key, and put your public key on github. The two top references are

您需要创建一个 ssh 密钥,并将您的公钥放在 github 上。两个最重要的参考是

http://help.github.com/mac-set-up-git/

http://help.github.com/mac-set-up-git/

and

http://help.github.com/ssh-issues/

http://help.github.com/ssh-issues/