How to enable GitHub 2FA with an authenticator
- Click your profile picture in the upper right, then Settings.
- In the sidebar's Access section, click Password and authentication.
- In the Two-factor authentication section, click Enable two-factor authentication.
- Under Scan the QR code, scan it, or click the setup key link to show the TOTP secret as text.
- Under Verify the code from the app, type the 6-digit code.
- Under Save your recovery codes, click Download, then click I have saved my recovery codes.
Menu names can change over time. If a step looks different, search the service's official help pages for "two-factor authentication".
About the GitHub setup key
The setup key is the TOTP secret for your account. GitHub's documentation lists the values for manual entry: type TOTP, issuer GitHub, algorithm SHA1, 6 digits and a 30-second period. These are the defaults in our 2FA code generator, so you only need to paste the key.
Get your GitHub 2FA code in the browser
- Open the 2FA code generator in a new tab.
- Paste the GitHub key into the box, or click Scan QR or the upload button to read the QR code.
- Your 6-digit GitHub 2FA code appears instantly, with a countdown to the next code.
- Copy the code and enter it in GitHub before the timer runs out.
When you use Git over HTTPS on the command line with 2FA enabled, GitHub expects a personal access token instead of your password, so set one up for your tools.
Developers who live in the browser often like having the code on the same screen. Keep the key in a password manager as well, so you are never tied to a single device.
GitHub recovery codes
GitHub gives you 16 recovery codes. Once you use a recovery code it cannot be reused, and if you use all 16 you can generate another list. To view them later, go to Settings → Password and authentication and click View next to Recovery codes, where you can download, print or copy them. Generating new codes invalidates the old ones.
GitHub also mentions other recovery methods, such as a verified SSH key or a personal access token. Set these up before you need them.
Add a second method
After setting up an authenticator, GitHub lets you add a security key or GitHub Mobile as extra methods. Having two methods makes a lockout much less likely. Read how to recover a 2FA account for more tips.
Our 2FA code generator is an independent tool and is not affiliated with GitHub.
Frequently asked questions
Where is the GitHub 2FA setup key?
During setup, under Scan the QR code, click the setup key link. GitHub shows the TOTP secret as text so you can enter it manually.
How many GitHub recovery codes are there?
GitHub gives you 16 recovery codes. Each can be used once, and generating new codes invalidates the previous list.
Which settings does GitHub use for TOTP?
GitHub uses TOTP with SHA1, 6 digits and a 30-second period, which are the standard defaults in most authenticators.
Can I use a browser authenticator for GitHub?
Yes. Any TOTP authenticator works with GitHub. Paste the setup key into our 2FA code generator to get the 6-digit code on your computer.