If you've lost access to your account after enabling two-factor authentication, GitHub can't help you gain access again. Having access to your recovery codes in a secure place, or establishing a secondary mobile phone number for recovery, will get you back into your account.

Use your saved recovery codes

Use one of your recovery codes to regain entry into your account. You may have saved these to a password manager, such as LastPass or 1Password.

At the bottom of the 2FA dialog, click Enter a two-factor recovery code to proceed using your code.

2FA recovery code dialog box

Depending on how you configured two-factor authentication, your authentication code will either be generated by an application or delivered to your phone via text message. You can choose to switch between delivery methods at any time.

Further reading