我在 Windows 上,我正在使用 Git Bash。我想克隆远程裸存储库。假设我已经正确设置了 ssh key ,因为我可以通过 ssh 协议(protocol)访问服务器。我通过尝试获取服务器上的目录列表对其进行了测试:
$ ssh user@servername.com ls
它要求输入密码:
Enter passphrase for key 'c/users/user/.ssh/id_rsa'
我输入它并成功获取目录列表。
但是,如果我尝试通过 ssh 克隆存储库,它会失败。我在 Git Bash 中写了以下内容:
$ git clone ssh://user@servername.com:80/path/to/repo.git
并得到以下错误:
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.
是 ssh key 的问题吗?或者它可能是其他东西,因为我已经测试了我的 key 工作?
最佳答案
你应该试试:
git clone ssh://user@servername.com:/path/to/repo.git
ssh 守护进程不太可能监听端口 80。
它将监听默认端口 (22)。
关于git - 无法从远程克隆 repo - ssh key 识别错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17890749/