我正在尝试从 github 克隆一个 repo。这样做
我使用 ssh-keygen 生成了一个 ssh key 。
然后我将 ~/.ssh/id_rsa.pub 的内容添加到我在 github 帐户中的 key 。
即使在那之后我也无法克隆任何 repo。我收到以下错误:
ssh_exchange_identification: read: Operation timed out
Please make sure you have the correct access rights
and the repository exists.
在这方面,我已经翻阅了这里的一些帖子,但无法解决。
注意:即使从我的 github 帐户中删除 SSH key 后,我仍面临此错误。
编辑:当我执行“ssh -T git@github.com”时,出现同样的错误:
ssh_exchange_identification: read: Operation timed out
如建议:https://help.github.com/en/articles/error-permission-denied-publickey ,同时执行以下命令:
1. ssh-add -l ==> The agent has no identities.
2. ssh-add -l -E md5 ==> The agent has no identities.
最佳答案
由于以下 3 个原因之一,您会收到此错误:
- 当您遇到身份验证/授权问题时
- 当您遇到互联网访问问题时
- SSh 问题
执行以下操作:
首先在您的终端运行 ssh -T git@github.com
如果您在响应中看到您的 GitHub 用户名。如果没有...,您就知道您已通过正确的身份验证......
首先检查互联网访问:确保您可以通过 SSH(而非 https)克隆公共(public)存储库(任何存储库)来访问 GitHub。如果你在此处失败,则说明 SSH 或互联网连接有问题
如果此步骤通过,请尝试通过 ssh 克隆您的另一个 private 存储库。如果你失败了。您遇到身份验证问题并且您的 ssh key 错误。 (通过https重试并比较结果)
如果此步骤通过,请尝试通过 https(而非 ssh)克隆此 repo。如果你失败了。你有一个授权问题,你无权访问这个 repo
关于git - 即使在添加 ssh key 后也无法克隆任何 git repo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58430267/