1

我在 Windows 上,我正在使用 Git Bash。我想克隆远程裸存储库。假设我已经正确设置了 ssh 密钥,因为我可以通过 ssh 协议访问服务器。我通过尝试获取服务器上的目录列表对其进行了测试:

$ 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 密钥的问题吗?或者因为我已经测试了我的密钥工作,它可能是别的东西?

4

1 回答 1

3

你应该试试:

git clone ssh://user@servername.com:/path/to/repo.git

ssh 守护程序不太可能在端口 80 上进行侦听。
它将在默认端口 (22) 上进行侦听。

于 2013-07-26T20:51:42.600 回答