Skip to main content
This guide demonstrates how to enable two-factor authentication (2FA) for an individual GitHub account, register an authenticator, save recovery codes, and verify the sign-in experience. At the end, we also cover how to begin inviting users and consider enterprise-level 2FA enforcement.

Prerequisites

  • A GitHub account (the example below uses an account named alice-admin-kk).
  • An authenticator app or extension that supports TOTP (Time-Based One-Time Passwords) such as 1Password, Microsoft Authenticator, Google Authenticator, Authy, Proton, or the GitHub Mobile app.
  • A secure place to store recovery codes (password manager, encrypted vault, or offline secure storage).

1 — Open account sign-in settings

Sign in to the account you want to secure. Open your account settings and navigate to the “Password and authentication” or “Sign in methods” section to view current sign-in options and whether 2FA is enabled.
A dark-mode screenshot of a GitHub account settings page for the user "alice-admin-kk." It shows the "Sign in methods" section (Email, Password, Passkeys, Google, Apple) and a left-hand navigation menu with account options.

2 — Choose a second-factor method

If 2FA is not yet enabled, start the setup flow. GitHub supports several second-factor methods:
SMS-based 2FA is less secure (subject to SIM swapping and interception). Prefer TOTP authenticators or hardware/WebAuthn methods where possible.

3 — Set up a TOTP authenticator

When setting up a TOTP authenticator, GitHub will display a QR code and a setup key. Use your authenticator app or browser extension to add the account. If the authenticator cannot scan the QR code (e.g., a browser extension without camera access), copy the setup key and add it manually.
A screenshot of GitHub's "Enable two-factor authentication (2FA)" setup page showing instructions, a QR code to scan with an authenticator app, and a field to enter the verification code. The page displays step 1 of the setup process with navigation and a Continue button.
Step-by-step:
  1. Open your authenticator app/extension and create a new account entry.
  2. Scan the QR code or paste the setup key provided by GitHub.
  3. Your authenticator will show a 6-digit TOTP code that rotates every 30 seconds.
  4. Enter the current code into GitHub to verify and continue.
Example authenticator apps:

4 — Save recovery codes

After verifying your authenticator, GitHub generates recovery codes. These are one-time-use codes that let you access your account if you lose your authenticator.
Store recovery codes somewhere safe (for example, a secure password manager or an encrypted file). Treat them like backup credentials.
Example recovery codes (store these securely):
After successful verification, GitHub will display confirmation and provide options to configure additional methods (passkeys, security keys, or GitHub Mobile).
A dark-themed GitHub settings screenshot showing a confirmation that two-factor authentication has been enabled. The page prompts configuring additional authentication methods (passkeys, security keys, GitHub Mobile) and shows a "Done" button with confetti in the background.

5 — Confirm the sign-in flow

To confirm everything works, sign out and sign back in. After entering your username and password, GitHub will prompt for a second-factor code. Provide:
  • The TOTP code from your authenticator, or
  • One of your saved recovery codes if you cannot access the authenticator.
If you lose access to both your authenticator and recovery codes, follow GitHub’s account recovery process: see GitHub Help: Recovering your account.

6 — Enterprise and organization considerations

At the enterprise or organization level, you can invite members and consider enforcing 2FA across the organization. Quick table of relevant enterprise settings:

Resources and further reading

Following these steps will help you secure your GitHub account with a modern second factor and prepare your organization for broader 2FA enforcement.

Watch Video