How to set up GitHub 2FA with a TOTP app
GitHub requires 2FA for everyone who contributes code. It works with any TOTP app and shows the exact settings it uses, so it's one of the easiest services to set up.
Updated 2026-11-19
Step by step
- Click your profile picture → Settings.
- In the Access section, open Password and authentication.
- Click Enable two-factor authentication.
- Under the QR code, click setup key to see the TOTP secret. Save it.
- Add the key to your TOTP app (or Get2FA) and type the code under Verify the code from the app.
- Download your recovery codes and store them safely, then click I have saved my recovery codes.
The settings GitHub uses
If you set up an app manually, GitHub's documentation lists: type TOTP, issuer GitHub, label GitHub:your-username, algorithm SHA1, 6 digits and a 30-second period. These are the defaults in Get2FA.
More than one device
To use 2FA on several devices, scan the QR code with each of them during setup, or save the setup key and add it later. If 2FA is already on, you have to reconfigure the TOTP app in your security settings to see a new key.
Extra protection
After the TOTP app, you can add a security key, a passkey or GitHub Mobile as extra methods, so losing one device doesn't lock you out.
Keep a copy of the key
Before you scan the QR code, look for the option to see the key as text and save it in your password manager. If your phone is lost or replaced, you can paste that key into Get2FA or a new authenticator app and get your codes back in seconds. Never share the key or a screenshot of the QR code: anyone who has it can generate your codes.
Guides
- What is 2FA (two-factor authentication)?
- Where to find your 2FA secret key
- How to turn on Instagram 2FA with an authentication app
- How to set up Facebook 2FA with an authenticator app
- How to transfer Google Authenticator to a new phone
- 2FA code not working? Here's how to fix it
- Lost your phone with the authenticator app? What to do
- “Enter a 6-digit login code generated by an authentication app”: what to do
- Fortnite 2FA: how to enable it at fortnite.com/2fa
- What is TOTP? (and TOTP vs HOTP)
- Microsoft Authenticator not showing a code? Here's the fix
- How to set up Amazon Two-Step Verification with an authenticator app
- How to turn on PayPal 2-step verification with an authenticator app
- How to set up Coinbase 2FA with an authenticator app
- How to enable Discord 2FA with an authenticator app
- How to set up X (Twitter) 2FA with an authentication app
- How to set up TikTok 2-step verification with an authenticator app
- How to use any authenticator app with your Microsoft account
- How to enable Binance 2FA with an authenticator app