git - 无法从远程克隆 repo - ssh key 识别错误

标签 git ssh

我在 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/

相关文章:

ssh - Vagrant 文件。设置 ssh 代理的区域设置

eclipse - egit 不显示标签装饰

git - pull git repo 时如何设置 ssh key ?

php - 通过 PHP CLI 确定终端行/列

python - 如何使用 python ssh 隧道连接到仅运行 telnet 的路由器?

Bash 脚本 "read"从 SSH shell 执行时不暂停用户输入

android - Gitignore 不会忽略文件夹 android,react native

git - 如何将部署的 git 修订写出到 Capistrano 中的文件

TFS 中的 Git - 分支切换 - 'Could not rmdir ...'

javascript - Webpack 无法导入从 git 安装的包