Skip to main content

丢失 2FA 凭据时恢复帐户

如果无法访问双重身份验证凭据,您可以使用恢复代码或其他恢复选项重新获取对帐户的访问权限。

警告

出于安全原因,如果你丢失了双重身份验证的凭据或无法访问你的帐户恢复方法,GitHub 支持人员将无法恢复访问启用了双重身份验证的帐户

注意

如果无法使用任何恢复方法,表示已永久失去对帐户的访问权限。 但是,可以取消链接已绑定到锁定帐户的电子邮件地址。 然后,可以将已取消链接的电子邮件地址链接到新的或现有的帐户。 有关详细信息,请参阅“从锁定的帐户取消链接电子邮件地址”。

使用双因素身份验证恢复代码

使用您的恢复代码之一自动重新进入您的帐户。 您可能已将恢复代码保存到密码管理器或计算机的下载文件夹中。 恢复代码的默认文件名为 github-recovery-codes.txt。 有关恢复代码的详细信息,请参阅“配置双重身份验证恢复方法”。

注意

如果不知道密码,可以在请求新密码后使用恢复代码。 请参阅“更新 GitHub 访问凭据”。

  1. Navigate to https://github.com/login.

  2. To prompt two-factor authentication, type your username and password, then click Sign in.

    注意

    If you have linked a social account to your GitHub account, you can sign-in with your social login instead of using your password.

  3. Under "More options", click 2FA recovery code.

  4. 输入恢复代码之一,然后单击“验证”。

使用密钥进行身份验证

如果你已将密钥添加到帐户,可以使用密钥自动重新获得对帐户的访问权限。 密钥同时满足密码和 2FA 要求,因此你无需知道密码即可恢复帐户。 请参阅“关于密钥”。

使用安全密钥进行身份验证

如果您使用安全密钥配置双重身份验证,则可以使用安全密钥作为辅助身份验证方法来自动重新获得对帐户的访问权限。 有关详细信息,请参阅“配置双重身份验证”。

使用后备号码进行身份验证

注意

不再支持配置除主要短信号码之外的回退短信号码。 相反,我们强烈建议注册多种身份验证方法。

如果无法访问首选 TOTP 应用程序或电话号码,则可以提供发送到后备号码的双因素身份验证码,以自动重新获得对帐户的访问权限。

使用经过验证的设备、SSH 令牌或 personal access token

进行身份验证

如果你知道 GitHub 的密码,但没有双因素身份验证凭据,或没有双因素身份验证恢复代码,则可以将一次性密码发送到经验证的电子邮件地址开始验证过程。 需要使用恢复身份验证因素(例如 SSH 密钥或以前验证的设备)验证身份。

注意

出于安全原因,使用一次性密码验证进行身份验证来重新获得帐户访问权限可能需要最长三个工作日。 在此期间,GitHub 不会审核提交的其他请求。

在这 3-5 天的等待期内,您随时可以使用双重身份验证凭据或双重身份验证恢复代码重新获得对帐户的访问权限。

警告

如果你用双因素身份验证保护个人帐户,但不知道密码,你将无法按照这些步骤恢复帐户。GitHub 可以将密码重置电子邮件发送到与你的帐户关联的已验证电子邮件地址。 有关详细信息,请参阅“更新 GitHub 访问凭据”。

  1. Navigate to https://github.com/login.

  2. To prompt two-factor authentication, type your username and password, then click Sign in.

    注意

    If you have linked a social account to your GitHub account, you can sign-in with your social login instead of using your password.

  3. Under "More options", click 2FA recovery code.

  4. Under "More options", click Begin account or email recovery.

  5. In the modal that appears, click I understand, get started.

  6. You may be required to verify an email address. To send an email containing a one-time password to each email address associated with your account, click Send one-time password.

    注意

    The one-time password will be sent to your primary and backup email addresses. Unless you have previously chosen a specific backup email address, all verified emails are considered backup email addresses.

  7. Type the one-time password from your email in the "One-time password" text field, then click Verify email address.

  8. Choose a recovery verification factor.

    • If you've used your current device to log into this account before and would like to use the device for verification, click Verify with this device.

    • If you've previously set up an SSH key on this account and would like to use the SSH key for verification, click SSH key.

    • If you've previously set up a personal access token and would like to use the personal access token for verification, click Personal access token.

    注意

    For security reasons, an authentication factor may not be available for recovery, even if you've used that authentication method with the account before. For example, SSH keys are removed from accounts after a period of inactivity.

A member of GitHub 支持 will review your request and email you within three business days. If your request is approved, you'll receive a link to complete your account recovery process. If your request is denied, the email will include a way to contact support.

在没有密码的情况下恢复

如果忘记了密码,可以请求一个新密码并在密码重置过程中恢复你的帐户。

使用双因素身份验证恢复代码来重置密码

如果你有恢复代码,可以使用它们来完成密码重置过程。 请参阅“更新 GitHub 访问凭据”。

在没有密码或双因素身份验证凭据的情况下恢复

如果失去了对双因素身份验证凭据和恢复代码的访问权限,可以启动帐户恢复请求。 需要使用恢复身份验证因素(例如 SSH 密钥或以前验证的设备)验证身份。

  1. 要请求新密码,请访问 https://github.com/password_reset。

  2. 输入与帐户关联的电子邮件地址,然后单击“发送密码重置电子邮件****”。

    注意

    只有主电子邮件地址和备用电子邮件地址可用于请求新密码。 除非你之前已选定特定的备用电子邮件地址,否则所有经过验证的电子邮件地址均视为备用电子邮件地址。

  3. GitHub 会给你发送一封电子邮件,其中包含一个可用于重置密码的链接。 您必须在收到电子邮件后的 3 小时内单击此链接。 如果您没有收到来自我们的电子邮件,请确保检查垃圾邮件文件夹。

  4. You will be prompted for your 2FA credentials. Under "More options", click Begin account or email recovery.

  5. In the modal that appears, click I understand, get started.

  6. Choose a recovery verification factor.

    • If you've used your current device to log into this account before and would like to use the device for verification, click Verify with this device.

    • If you've previously set up an SSH key on this account and would like to use the SSH key for verification, click SSH key.

    • If you've previously set up a personal access token and would like to use the personal access token for verification, click Personal access token.

    注意

    For security reasons, an authentication factor may not be available for recovery, even if you've used that authentication method with the account before. For example, SSH keys are removed from accounts after a period of inactivity.

A member of GitHub 支持 will review your request and email you within three business days. If your request is approved, you'll receive a link to complete your account recovery process. If your request is denied, the email will include a way to contact support.

取消链接电子邮件地址

如果已经用尽了恢复选项,可以将电子邮件地址与帐户断开链接。 然后,可以将电子邮件地址链接到新的或现有的帐户,从而保留提交历史记录。 请参阅“从锁定的帐户取消链接电子邮件地址”。

延伸阅读