Is there a way to restore Github and Bitbucket 2FA without recovery codes or backup phone number?

Solution 1:

Luckily for me, there is a way to do this if you assigned a SSH key to your account.

What you need to do is to run this command on the computer where you have the SSH key:

ssh -T [email protected] verify

And send the output to Github support. With that output they are able to disable your 2fa and allowing you to login just with your password.

The output should look like this:

Please provide the following verification token to GitHub Support.
002de4e72d08f47b0b828bab0224dxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxf6174ce54ab0040aa7075626c69635f6b6579ce008cacf9

If you are reading this it's probably too late for that advice but don't be stupid like I was. Save the recovery codes or set up a phone number!

Solution 2:

This works only if you have access to your bitbucket and github via SSH. Even for @achiash 's answer.

For github as @achiash mentioned you can use

ssh -T [email protected] verify

This will print the verification code on your screen.

For bitbucket you can use

ssh [email protected] recovery_codes

This will ask you for password. Enter the password and it will print your recover codes.