2段階認証の数字が取得できなくなり、かつrecovery codesを紛失したときはSSH用秘密鍵さえあれば2段階認証の解除を要求することができる

前提

GitHubとのSSH用秘密鍵が手元に残っている

手順

  1. Contact GitHubに発生している問題とverification tokenを連絡
  2. サポートからのメールに返信
  3. 2段階認証解除を確認

Contact GitHubに発生している問題を連絡

https://github.com/contact のサポートフォームから

Name: 任意の名前
Email: サポートメールを受け取るアドレス
Subject: 「2段階認証を解除してくれ」という旨の英文
How can we help?: 「2段階認証の数字が取得でない, recovery codesも無いため認証解除してほしい」という旨の英文とverification token

を送信する

verification tokenは以下のコマンドで取得

1
2
3
$ ssh -T git@github.com verify
Please provide the following verification token to GitHub Support.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

サポートからのメールに返信

しばらく待つとEmailに入力したアドレスにサポートからのメールが届く
(今回の解除要求では1時間ほどで届いた)

The quickest way to regain access to an account is by using the recovery codes we asked you to download when you enabled 2FA for your account. Even if you think you might not have them, it’s worth searching your computer and backups just to be sure; you’d be surprised how often these turn up! They would have had the default filename github-recovery-codes.txt or github_2fa_recovery_codes.txt.

If you definitely don’t have valid recovery codes, please let us know.

Thanks,

How can we help?にrecovery codesが無いと書いてもこれが届いたため、おそらく内容に関わらず1度は探すよう要求するのだと思われる
しっかり探した上で見つからなかったので解除して欲しいと返信

2段階認証解除を確認

折り返し2段階認証を解除したという内容のメールが届くため、ログインして解除を確認する