Gitlab Account 2FA lost

JanMer picture JanMer · Aug 25, 2016 · Viewed 8.9k times · Source

I have lost my Phone and do not have the recovery code for my 2FA for GitLab.

So I am locked out of my account.
What are my options?

Answer

Nexus6 picture Nexus6 · Sep 2, 2017

I know this is an old question, but the following, which I have tested only with gitlab.com free hosted accounts, may be useful for others with GitLab 2fa problems.

IF

  • you have set up 2fa but then lost access to your 2fa device for some reason, and
  • you have lost (or never saved) your recovery codes, and
  • you had previously configured your ssh key in your gitlab.com account

THEN ...

You can create a brand new list of recovery codes via ssh:

ssh [email protected] 2fa_recovery_codes

Answer the questions and save the list of recovery codes somewhere safe this time! I'm guilty of all of the above and this solution provided by GitLab is both simple and elegant.

Source: https://gitlab.com/gitlab-org/gitlab-ce/issues/3765