git 找不到正确的 ssh
git cant find correct ssh
当我尝试使用 git 连接时,我看到了这个错误
$ git clone git@github.com:MyCompany/eagle.git --verbose
Cloning into 'eagle'...
FATAL ERROR: Couldn't agree a key exchange algorithm (available: curve25519-sha256@libssh.org,ecdh-sh
a2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521)
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我设置了所有密钥等,连接工作正常,因为当我这样做时
ssh -v git@github.com
连接成功。
我该怎么做才能了解哪里出了问题以及应该更正什么?
谢谢,
如果 ssh -T git@github.com
给你:
Hi <name>! You've successfully authenticated, but GitHub
does not provide shell access.
消息,这意味着您的 ssh 设置正在运行。如果你得到:
FATAL ERROR: Couldn't agree a key exchange algorithm ...
这意味着您的 ssh 设置没有工作。显然这里有一个矛盾,最有可能的罪魁祸首是你安装了两个不同的 ssh
命令:一个你正在使用,有效,另一个 Git 在使用,但没有。
This answer to Git with SSH on Windows 有很多赞成票。我避免使用 Windows,所以我不知道这是否有帮助。 (我什至不知道你是否在 Windows 因为你没有提到它。)
请注意 Git version 2.3.0 added GIT_SSH_COMMAND
, and Git version 2.10.0 added core.sshCommand
to set a value for GIT_SSH_COMMAND
. Since then, Git version 2.13.0 learned some new tricks for dealing with issues tied to variations of ssh that demand different option letters. In all cases it's important to figure out which ssh Git is running, and make sure it runs one that actually works. See the top level Git documentation 所有选项变量及其作用的描述。这里的 link 转到的网页可能与您自己的 Git 版本不匹配,因此请考虑 运行 git --help git
阅读该版本,如果您的 Git很老了。
问题出在 GIT_SSH。此变量之前已由 putty 设置。
我删除了这个环境变量,问题已经解决
这可能与 GitHub removing weak crypto 有关。这发生在 2018 年 2 月 22 日左右。
对我来说,这是因为:
- 我已 Git 配置为使用 PuTTY(即
GIT_SSH=C:\Program Files\PuTTY\plink.exe
)
- 我是 运行 旧版本的 PuTTY(例如 0.63)
- GitHub 最近有 removed weak cryptography standards.
我卸载了 PuTTY 0.63 和 downloaded 并安装了最新版本的 PuTTY(此时为 0.70),这解决了我的问题。
我一直在使用 SourceTree,然后是 putty,然后是 open-ssh。实际上弄得一团糟,在检查 GIT_SSH
env 变量值时使用了与 SourceTree 一起安装的腻子。需要删除此 env 变量才能使用 open-ssh。 (所以没有用putty)
对于新手,我使用此代码段通过 open-ssh "login" 到 github:
eval $(ssh-agent -s) && ssh-add ~/.ssh/mySHHKey
编辑:没关系,我昨天成功连接了,但现在它停止工作了...同时使用 pageant 和 putty。
当我尝试使用 git 连接时,我看到了这个错误
$ git clone git@github.com:MyCompany/eagle.git --verbose
Cloning into 'eagle'...
FATAL ERROR: Couldn't agree a key exchange algorithm (available: curve25519-sha256@libssh.org,ecdh-sh
a2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521)
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我设置了所有密钥等,连接工作正常,因为当我这样做时
ssh -v git@github.com
连接成功。
我该怎么做才能了解哪里出了问题以及应该更正什么?
谢谢,
如果 ssh -T git@github.com
给你:
Hi <name>! You've successfully authenticated, but GitHub
does not provide shell access.
消息,这意味着您的 ssh 设置正在运行。如果你得到:
FATAL ERROR: Couldn't agree a key exchange algorithm ...
这意味着您的 ssh 设置没有工作。显然这里有一个矛盾,最有可能的罪魁祸首是你安装了两个不同的 ssh
命令:一个你正在使用,有效,另一个 Git 在使用,但没有。
This answer to Git with SSH on Windows 有很多赞成票。我避免使用 Windows,所以我不知道这是否有帮助。 (我什至不知道你是否在 Windows 因为你没有提到它。)
请注意 Git version 2.3.0 added GIT_SSH_COMMAND
, and Git version 2.10.0 added core.sshCommand
to set a value for GIT_SSH_COMMAND
. Since then, Git version 2.13.0 learned some new tricks for dealing with issues tied to variations of ssh that demand different option letters. In all cases it's important to figure out which ssh Git is running, and make sure it runs one that actually works. See the top level Git documentation 所有选项变量及其作用的描述。这里的 link 转到的网页可能与您自己的 Git 版本不匹配,因此请考虑 运行 git --help git
阅读该版本,如果您的 Git很老了。
问题出在 GIT_SSH。此变量之前已由 putty 设置。 我删除了这个环境变量,问题已经解决
这可能与 GitHub removing weak crypto 有关。这发生在 2018 年 2 月 22 日左右。
对我来说,这是因为:
- 我已 Git 配置为使用 PuTTY(即
GIT_SSH=C:\Program Files\PuTTY\plink.exe
) - 我是 运行 旧版本的 PuTTY(例如 0.63)
- GitHub 最近有 removed weak cryptography standards.
我卸载了 PuTTY 0.63 和 downloaded 并安装了最新版本的 PuTTY(此时为 0.70),这解决了我的问题。
我一直在使用 SourceTree,然后是 putty,然后是 open-ssh。实际上弄得一团糟,在检查 GIT_SSH
env 变量值时使用了与 SourceTree 一起安装的腻子。需要删除此 env 变量才能使用 open-ssh。 (所以没有用putty)
对于新手,我使用此代码段通过 open-ssh "login" 到 github:
eval $(ssh-agent -s) && ssh-add ~/.ssh/mySHHKey
编辑:没关系,我昨天成功连接了,但现在它停止工作了...同时使用 pageant 和 putty。