Setup 2FA On github
About
2FA (two-factor authentication) means you need two things to log in: your password, and a short code from an app on your phone. This adds extra protection if someone steals your password.
What you need
- Your phone, with the Microsoft Authenticator app installed (see the guide for adding Authenticator to your phone if you don’t have it yet)
- A safe place to store your recovery codes (for example a password manager)
1. Start the setup
Go to github.com and sign in. A banner appears asking you to turn on 2FA. Click Enable 2FA.
2. Add GitHub in Microsoft Authenticator
GitHub now shows a QR code (a square pattern that your phone can scan). On your phone:
- Open Microsoft Authenticator.
- Tap the + to add a new account.
- Choose Other account as the type.
- Scan the QR code on your computer screen with your phone’s camera.
GitHub is now added in the app, and the app shows a 6-digit code for it. The code changes every 30 seconds or so.
3. Verify the code
On your computer, find the field Verify the code from the app. Type in the 6-digit code that Authenticator shows for GitHub. Click Continue.
4. Save your recovery codes
GitHub now shows recovery codes. These are one-time codes that let you log in if you lose your phone. Click Download and store the file in a secure place.
Important: Do not skip this step. Without recovery codes, losing your phone can lock you out of your account.
And you are done. 😄
Sources
- GitHub’s guide to enabling 2FA: https://docs.github.com/en/authentication/securing-your-account-with-two-factor-authentication-2fa/configuring-two-factor-authentication
- GitHub’s guide to recovery codes: https://docs.github.com/en/authentication/securing-your-account-with-two-factor-authentication-2fa/configuring-two-factor-authentication-recovery-methods
- Microsoft’s guide to adding accounts in Authenticator: https://support.microsoft.com/en-us/account-billing/add-non-microsoft-accounts-to-the-microsoft-authenticator-app-7a1a6c3b-6a73-4b5a-a8d3-7c4b4e1d4c1b