阅读(932) (0)

GitHub 测试 SSH 连接

2020-08-19 14:00:39 更新

设置 SSH 密钥并将其添加到您的 GitHub 帐户后,您可以测试连接。

测试 SSH 连接之前,您应已完成以下各项:

测试连接时,您将需要使用密码(即您之前创建的 SSH 密钥密码)验证此操作。 有关使用 SSH 密钥密码的更多信息,请参阅“使用 SSH 密钥密码”。

  1. 打开 Git Bash。

  1. 输入以下内容:

   $ ssh -T git@github.com
   # Attempts to ssh to GitHub

您可能会看到类似如下的警告:

   > The authenticity of host 'github.com (IP ADDRESS)' can't be established.
   > RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
   > Are you sure you want to continue connecting (yes/no)?

或类似如下:

   > The authenticity of host 'github.com (IP ADDRESS)' can't be established.
   > RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
   > Are you sure you want to continue connecting (yes/no)?

  1. 验证您看到的消息中的指纹匹配步骤 2 中的消息之一,然后输入 yes

   > Hi username! You've successfully authenticated, but GitHub does not
   > provide shell access.

  1. 验证生成的消息包含您的用户名。 如果收到“权限被拒绝”消息,请参阅“错误:权限被拒绝(公钥)”