How to turn on GitHub 2FA with an authenticator app
To turn on GitHub 2FA: Settings → Password and authentication → Enable two-factor authentication, click "setup key" for the text key, enter the 6-digit code and download recovery codes. Use a token or SSH key for git push afterwards.

GitHub requires two-factor authentication for accounts that contribute code. Setting it up with an authenticator takes two minutes; storing the recovery codes is the part that matters.
Enable 2FA
- Click your avatar → Settings → Password and authentication.
- Click Enable two-factor authentication.
- GitHub shows a QR code. Click setup key to see the text key if you can't scan. Save it.
- Scan the QR or paste the key into an authenticator or Code2FA, then enter the 6-digit code.
- Download your recovery codes and keep them away from the computer you use.
Add stronger methods
- Passkeys and security keys resist phishing better than 6-digit codes. See what passkeys are.
- GitHub Mobile approves sign-ins with a push prompt.
- SMS isn't available in every country and is weaker.
Using Git on your computer after 2FA
Your account password no longer works for git push over HTTPS. Use a personal access token or an SSH key. For automation, create a token with minimal scopes instead of storing a 2FA secret. See 2FA codes in scripts for when automating 2FA makes sense and when it doesn't.
Lost your authenticator
Use a recovery code. GitHub can also recover through a registered SSH key or verified device, but that takes days. Keep at least two methods.
FAQ
Is 2FA required on GitHub?
GitHub requires 2FA for accounts that contribute code and prompts you to enable it within a deadline.
Where is the GitHub setup key?
During 2FA setup, click "setup key" under the QR code to see the text key.


