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.
When you set up two-factor authentication, you were provided a set of recovery codes, intended to be stored somewhere safe. You can use one of these recovery codes to regain entry into your account.
In case you lose access to your primary phone, GitHub can send authentication codes to this secondary number. 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.