Skip to main content

Authorizing an SSH key for use with single sign-on

To use an SSH key with an organization that uses single sign-on (SSO), you must first authorize the key.

About authorization of SSH keys

You can authorize an existing SSH key, or create a new SSH key and then authorize it. For more information about creating a new SSH key, see 生成新的 SSH 密钥并将其添加到 ssh-agent.

注意

如果你拥有某一组织的链接标识,则只能通过该组织使用授权的 personal access token 和 SSH 密钥,即使未强制执行 SAML 也是如此。 如果已通过 SAML SSO 对某一组织进行了身份验证,你则拥有该组织的链接标识,除非组织或企业所有者后来撤销了该链接标识。 有关撤销链接标识的详细信息,请参阅 查看和管理成员 SAML 对组织的访问权限查看和管理用户对企业的 SAML 访问

在可以授权 personal access token 或 SSH 密钥之前,必须拥有一个链接的 SAML 标识。 如果你是已启用 SAML SSO 的组织的成员,则可以至少通过使用 IdP 向组织进行一次身份验证来创建链接标识。 有关详细信息,请参阅“About authentication with single sign-on”。

授权 personal access token 或 SSH 密钥后,令牌或密钥将保持已授权状态,直到以下列方式之一撤销。

  • 组织或企业所有者撤销授权。
  • 你已从组织中移除。
  • 已编辑 personal access token 中的范围,或重新生成了令牌。
  • personal access token 在创建期间已按定义过期。

注意

If your SSH key authorization is revoked by an organization, you will not be able to reauthorize the same key. You will need to create a new SSH key and authorize it. For more information about creating a new SSH key, see 生成新的 SSH 密钥并将其添加到 ssh-agent.

You do not need to authorize SSH certificates signed by your organization's SSH certificate authority (CA).

Authorizing an SSH key

  1. 在 GitHub 任意页面的右上角,单击个人资料照片,然后单击 “设置”****。

  2. 在边栏的“访问”部分中,单击 “SSH 和 GPG 密钥”。

  3. To the right of the SSH key you'd like to authorize, click Configure SSO. 如果没有看到“配置 SSO”,请确保已通过 SAML IdP 至少进行了一次身份验证,以访问 GitHub 上的资源。 有关详细信息,请参阅“About authentication with single sign-on”。

    Screenshot of the "Authentication Keys" section. Next to a key, a dropdown menu, labeled "Configure SSO," is outlined in orange.

  4. In the dropdown menu, to the right of the organization you'd like to authorize the SSH key for, click Authorize.

Further reading