{"meta":{"title":"关于 SSH","intro":"使用 SSH 协议可以连接远程服务器和服务并向它们验证。 利用 SSH 密钥可以连接到 GitHub，而无需在每次访问时都提供用户名和 personal access token。 还可以使用 SSH 密钥对提交进行签名。","product":"身份验证","breadcrumbs":[{"href":"/zh/authentication","title":"身份验证"},{"href":"/zh/authentication/connecting-to-github-with-ssh","title":"使用 SSH 进行连接"},{"href":"/zh/authentication/connecting-to-github-with-ssh/about-ssh","title":"关于 SSH"}],"documentType":"article"},"body":"# 关于 SSH\n\n使用 SSH 协议可以连接远程服务器和服务并向它们验证。 利用 SSH 密钥可以连接到 GitHub，而无需在每次访问时都提供用户名和 personal access token。 还可以使用 SSH 密钥对提交进行签名。\n\n可以使用 SSH（安全外壳协议）在 GitHub 上的存储库中访问和写入数据。 通过 SSH 进行连接时，使用本地计算机上的私钥文件进行身份验证。 有关 SSH 的详细信息，请参阅 Wikipedia 上的[安全外壳](https://en.wikipedia.org/wiki/Secure_Shell)。\n\n设置 SSH 时，需要生成新的 SSH 私钥并将其添加到 SSH 代理中。 使用密钥进行身份验证或对提交进行签名之前，还必须将 SSH 公钥添加到 GitHub 上的帐户中。 有关详细信息，请参阅“[生成新的 SSH 密钥并将其添加到 ssh-agent](/zh/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)”、“[将新的 SSH 密钥添加到GitHub帐户](/zh/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account)”和“[关于提交签名验证](/zh/authentication/managing-commit-signature-verification/about-commit-signature-verification)”。\n\n您可以使用硬件安全密钥来进一步保护 SSH 密钥，当密钥对用于通过 SSH 进行身份验证时，需要将物理硬件安全密钥附加到计算机上。 您还可以通过将密钥添加到 ssh 代理并使用密码来保护您的 SSH 密钥。 有关详细信息，请参阅“[使用 SSH 密钥密码](/zh/authentication/connecting-to-github-with-ssh/working-with-ssh-key-passphrases)”。\n\n若要将 SSH 密钥与使用 SAML 单一登录的组织拥有的存储库一起使用，必须授权该密钥。 有关详细信息，请参阅 GitHub Enterprise Cloud 文档中的 [将 SSH 密钥授权用于单点登录](/zh/enterprise-cloud@latest/authentication/authenticating-with-saml-single-sign-on/authorizing-an-ssh-key-for-use-with-saml-single-sign-on)。\n\n为了保持帐户安全，您可以定期检查您的 SSH 密钥列表，并撤销任何无效或已泄漏的密钥。 有关详细信息，请参阅“[检查 SSH 密钥](/zh/authentication/keeping-your-account-and-data-secure/reviewing-your-ssh-keys)”。\n\n如果一年没有使用 SSH 密钥，则作为安全预防措施，GitHub 将自动删除你的非活动 SSH 密钥。 有关详细信息，请参阅“[已删除或缺少的 SSH 密钥](/zh/authentication/troubleshooting-ssh/deleted-or-missing-ssh-keys)”。\n\n使用 GitHub Enterprise Cloud 的组织可以提供 SSH 证书，成员可以使用该证书访问组织的存储库，而无需将其添加到他们在 GitHub 上的帐户。 如果使用 SSH 证书，当分支为个人帐户所有时，将无法使用该证书访问组织存储库的分支。 有关详细信息，请参阅 GitHub Enterprise Cloud 文档中的“[关于 SSH 证书颁发机构](/zh/enterprise-cloud@latest/organizations/managing-git-access-to-your-organizations-repositories/about-ssh-certificate-authorities)”。\n\n## 其他阅读材料\n\n* [SSH 故障排除](/zh/authentication/troubleshooting-ssh)"}