【问题标题】:Unable to clone any git repo even after adding ssh keys即使在添加 ssh 密钥后也无法克隆任何 git repo
【发布时间】:2019-10-17 19:18:34
【问题描述】:

我正在尝试从 github 克隆一个 repo。这样做

  1. 我使用 ssh-keygen 生成了一个 ssh 密钥。

  2. 然后我将 ~/.ssh/id_rsa.pub 的内容添加到我在 github 帐户中的密钥中。

即使在那之后我也无法克隆任何 repo。我收到以下错误:

ssh_exchange_identification: read: Operation timed out
Please make sure you have the correct access rights
and the repository exists.

在这方面,我在这里浏览了几篇帖子,但无法修复。

注意:即使从我的 github 帐户中删除 SSH 密钥后,我也会遇到此错误。

编辑:当我执行“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.

【问题讨论】:

    标签: git github ssh


    【解决方案1】:

    由于以下 3 个原因之一,您会收到此错误:

    1. 当您遇到身份验证/授权问题时
    2. 当您遇到互联网访问问题时
    3. SSH 问题

    执行以下操作:

    如果您看到您的 GitHub 用户名作为响应,请首先在您的终端中运行 ssh -T git@github.com。如果没有,您就知道您已通过正确的身份验证...

    首先检查互联网访问:确保您可以通过 SSH(不是 https)克隆公共 repo(任何 repo)来访问 GitHub。如果您在此处失败,则说明 SSH 或 Internet 连接有问题

    如果此步骤通过,请尝试通过 ssh 克隆您的其他 private 存储库之一。如果你失败了。您遇到了身份验证问题,并且您的 ssh 密钥错误。 (通过https重试并比较结果)

    如果此步骤通过,请尝试通过 https(不是 ssh)克隆此 repo。如果你失败了。您有授权问题,您无权访问此 repo

    【讨论】:

    • 互联网很好,因为我可以使用 https 克隆同一个仓库
    • 在终端中运行这个命令的结果是什么? ssh -T git@github.com
    • 那么有 SSH 问题...您确定 SSH 端口没有被防火墙关闭吗?还是您的互联网提供商?
    • 是的,我不知道如何解决它?我在我的 github 中多次添加/删除了 ssh 密钥。
    • 您没有 ssh 密钥问题(至少到目前为止!)无论密钥如何,您都有 SSH 问题!找到一个免费的 ssh 服务器并尝试连接它们。如果你没有,你可以在这里找到:shells.red-pill.eu。这不是与 github 相关的问题。这是一个与 SSH 相关的问题。您错误更改了 ssh 配置或您的网络禁止了 ssh 数据包
    猜你喜欢
    • 1970-01-01
    • 2013-08-07
    • 1970-01-01
    • 1970-01-01
    • 2020-09-10
    • 1970-01-01
    • 1970-01-01
    • 2010-11-05
    相关资源
    最近更新 更多