测试 SSH 连接之前,应已完成以下各项:
- 检查是否存在现有的 SSH 密钥
- 生成新 SSH 密钥
-
[向 GitHub 帐户添加了新的 SSH 密钥](/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account)
需要使用密码(即之前创建的 SSH 密钥密码)来验证此操作。 请参阅AUTOTITLE。
-
打开终端终端Git Bash。
-
输入以下内容:
Shell ssh -T git@HOSTNAME # Attempts to ssh to GitHub
ssh -T git@HOSTNAME # Attempts to ssh to GitHub您可能会看到类似如下的警告:
> The authenticity of host 'HOSTNAME (IP ADDRESS)' can't be established. > ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU. > Are you sure you want to continue connecting (yes/no)? -
验证所看到消息中的指纹是否与 企业的公钥指纹匹配。 如果是,则键入 :
> Hi USERNAME! You've successfully authenticated, but GitHub does not > provide shell access.你可能会看到此错误消息:
... Agent admitted failure to sign using the key. debug1: No more authentication methods to try. Permission denied (publickey).这是某些 Linux 发行版的已知问题。 有关详细信息,请参阅“AUTOTITLE”。
注意
远程命令应以代码 1 退出。
-
验证生成的消息包含您的用户名。 如果收到“权限被拒绝”消息,请参阅“AUTOTITLE”。