我已经在新笔记本电脑上重新安装了Git(2.20.1.windows.1版),但无法克隆任何Github存储库。我也尝试过Gitlab,并且遇到了同样的问题。
这是我尝试克隆Github调试存储库时遇到的错误:
$ git clone git@github.com:github/debug-repo debug-repo-ssh
Cloning into 'debug-repo-ssh'...
Received disconnect from 140.82.118.4 port 22:11: Bye Bye
Disconnected from 140.82.118.4 port 22
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
以下是ssh -vT git@github.com
命令的输出:
$ ssh -vT git@github.com
OpenSSH_7.9p1, OpenSSL 1.1.1a 20 Nov 2018
debug1: Reading configuration data /c/Users/Tam/.ssh/config
debug1: /c/Users/Tam/.ssh/config line 1: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [140.82.118.4] port 22.
debug1: Connection established.
debug1: identity file /c/Users/Tam/.ssh/id_github type 0
debug1: identity file /c/Users/Tam/.ssh/id_github-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version babeld-64adca0f
debug1: no match: babeld-64adca0f
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
Received disconnect from 140.82.118.4 port 22:11: Bye Bye
Disconnected from 140.82.118.4 port 22
甚至还没有问到我的密码短语。
答案 0 :(得分:1)
我无法弄清楚为什么git捆绑的ssh无法在笔记本电脑上运行,但是我找到了一个稳定的解决方法。
在安装并重新打开PowerShell之后,运行ssh -vT git@github.com
要求输入我的密码并成功验证了我的身份,但是git-agent
命令失败。这是一个类似Could not connected to the authentication agent
OpenSSH Authentication Agent
服务。我将启动模式设置为“自动”(延迟启动)。这使ssh-agent
,ssh-add
和ssh-add -l
命令正常工作,但是git命令仍然失败,并且错误与以前完全相同。
SSH_GIT
环境变量设置为安装OpenSSH的位置。对我来说就是C:\Windows\System32\OpenSSH\ssh.exe
。 Here's a guide that should help. 一旦我这样做并重新启动PowerShell,git clone和所有其他命令就会开始工作。