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 GitHub account.
If you've lost access to your GitHub account after enabling two-factor authentication, GitHub can't help you gain access again. Instead, use one of these methods to regain access to your account.
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.
If you lose access to your primary phone and have set up a fallback number, GitHub can send authentication codes to this secondary number instead. This option is available to you no matter which delivery method you've configured. You can set this number on the two-factor authentication settings page.
Tip: GitHub Enterprise cannot send security codes as SMS messages—it only supports TOTP smartphone clients, such as Google Authenticator.