GitLab re-generate 2FA recovery code


In case you lose your device or your TOTP code does not match the server side and your recovery code dismiss. You can use any device which has ssh-keys to enter

ssh [email protected] 2fa_recovery_codes

then the GitLab server will re-generate the new recovery code for you. The result will looks like below:

ssh [email protected] 2fa_recovery_codes
Are you sure you want to generate new two-factor recovery codes?
Any existing recovery codes you saved will be invalidated. (yes/no)
yes

Your two-factor authentication recovery codes are:

****************
****************
****************
****************
****************
****************
****************
****************
****************
****************

During sign-in, use one of the codes above when prompted for
your two-factor code. Then, visit your Profile Settings and add
a new device so you do not lose access to your account again.

After that, you can enter GitLab and setup new device again.