How to set up 2FA on GitHub

Checked against GitHub's own help on 10 October 2026. Menus change, so follow the nearest label if yours differs.

Short answer

Open GitHub's security settings (Settings, Password and authentication), choose the authenticator app option, and scan the QR code GitHub shows with KeyNesta (or enter the setup key by hand). Type the six-digit code KeyNesta shows back into GitHub to finish, and save the recovery material GitHub gives you before you close the page.

Before you start

Have KeyNesta open and unlocked before GitHub shows the QR code, so the code is ready the moment it appears. KeyNesta needs no account to do this. It stores authenticator-app codes only: it does not do passkeys or hardware security keys, and where GitHub offers those you set them up in GitHub directly.

Steps

  1. Click your profile picture in the upper-right corner, then Settings.
  2. In the sidebar's Access section, click Password and authentication.
  3. In the Two-factor authentication section, click Enable two-factor authentication.
  4. Under Scan the QR code, GitHub shows a QR code. Leave it on screen.
  5. Add it to KeyNesta. Open the KeyNesta web app (or the app on your phone once it is released), unlock your vault, choose Scan QR and point the camera at the code on screen. If you cannot scan, use Import QR image, or choose Add entry to paste the setup key.
  6. Enter the six-digit code from KeyNesta in the field under Verify the code from the app.
  7. Under Save your recovery codes, click Download, store the file, then click I have saved my recovery codes.
  8. Optionally add a second method, such as a security key or GitHub Mobile, to reduce the risk of lockout.
GitHubWhat to know
Where to startSettings, Password and authentication
Setup key as textClick the setup key link under the QR code, then paste the key into KeyNesta (or type it into the manual entry fields).
Recovery materialGitHub gives you recovery codes during setup and lets you generate and download a fresh set later from the recovery methods settings.
SourceGitHub Docs: Configuring two-factor authentication

Backup and recovery for GitHub

GitHub gives you recovery codes during setup and lets you generate and download a fresh set later from the recovery methods settings.

Save whatever GitHub gives you somewhere that is not the phone holding your codes. Where to store your 2FA backup codes compares the options, and 2FA backup and sync covers backing up the KeyNesta vault itself.

Source

Menu paths on this page come from GitHub Docs: Configuring two-factor authentication, read on 10 October 2026. KeyNesta is not affiliated with GitHub.

Frequently asked questions

Can I use KeyNesta as the authenticator app for GitHub?

Yes. GitHub asks for a standard time-based code, and KeyNesta reads the same QR code or setup key and generates that code on your device, offline. GitHub does not learn which app you chose. KeyNesta holds authenticator-app codes only; it has no passkey or hardware security key support. How to add the code is in How do I add a 2FA code to KeyNesta?

What happens to my GitHub 2FA if I lose my phone?

Use one of your recovery codes, or a second method such as a security key or GitHub Mobile if you added one. If your KeyNesta vault is synced or you made an encrypted backup, you can restore the codes on another device; the lost phone guide covers the order to do things in.

How do I add GitHub to KeyNesta if I cannot scan the QR code?

Click the setup key link under the QR code, then paste the key into KeyNesta (or type it into the manual entry fields). In KeyNesta you can also upload a screenshot with Import QR image, paste an otpauth:// link, or add the entry by hand with the secret. Delete any screenshot of the QR afterwards: it works like a password.

Can I use the same GitHub code on two devices?

Codes come from a shared secret, so any app that holds the secret shows the same codes. The tidy way is KeyNesta's optional end-to-end encrypted sync, which carries the vault to a second device. The alternative is to add the secret to a second app while the QR code is still on screen; once GitHub stops showing it, you cannot get it back without re-enrolling.

Can I use a security key with GitHub as well as KeyNesta?

GitHub's own steps suggest adding a security key or GitHub Mobile as a backup method. KeyNesta has no hardware security key or passkey support, so use GitHub's for those and KeyNesta for the authenticator-app code.

Is the GitHub setup key the same as my recovery codes?

No. The setup key is the secret behind the QR code and is used to add the authenticator. Recovery codes are separate one-time codes for getting in when you have no authenticator at all. Save both kinds of material, in different places.

Do I need a TOTP app installed before I turn on two-factor authentication on GitHub?

GitHub's steps start with installing a TOTP app, because the QR code is scanned straight away. Open KeyNesta first so the code is ready when GitHub shows it.

Try KeyNesta free. The web app needs no sign-up.

Open the web app All platforms