Skip to main content

测试 SSH 连接

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

Platform navigation

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

需要使用密码(即之前创建的 SSH 密钥密码)来验证此操作。 请参阅“使用 SSH 密钥密码”。

  1. 打开终端终端Git Bash

  2. 输入以下内容:

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

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

    > The authenticity of host 'github.com (IP ADDRESS)' can't be established.
    > ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
    > Are you sure you want to continue connecting (yes/no)?
    
  3. 验证所看到消息中的指纹是否与 GitHub 的公钥指纹匹配。 如果是,则键入 yes

    > 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 发行版的已知问题。 有关详细信息,请参阅“错误:代理承认没有签署”。

    注意

    远程命令应退出,并显示代码 1。

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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy