Note: Starting in March 2023 and through the end of 2023, GitHub will gradually begin to require all users who contribute code on GitHub.com to enable one or more forms of two-factor authentication (2FA). If you are in an eligible group, you will receive a notification email when that group is selected for enrollment, marking the beginning of a 45-day 2FA enrollment period, and you will see banners asking you to enroll in 2FA on GitHub.com. If you don't receive a notification, then you are not part of a group required to enable 2FA, though we strongly recommend it.
For more information about the 2FA enrollment rollout, see this blog post.
You can configure two-factor authentication (2FA) using a mobile app or via text message. You can also add a security key.
We strongly recommend using a time-based one-time password (TOTP) application to configure 2FA, and security keys as backup methods instead of SMS. TOTP applications are more reliable than SMS, especially for locations outside the United States. Many TOTP apps support the secure backup of your authentication codes in the cloud and can be restored if you lose access to your device.
After you configure 2FA, your account will enter a 28-day check up period. You can leave the check up period by successfully performing 2FA in those 28 days. Otherwise, you will be prompted to perform 2FA in an existing GitHub.com session on the 28th day. If you cannot perform 2FA to pass the checkup, you must use the provided shortcut to reconfigure your 2FA settings and retain access to GitHub.com.
If you're a member of an enterprise with managed users, you cannot configure 2FA for your managed user account account unless you're signed in as the setup user. For users other than the setup user, an administrator must configure 2FA on your identity provider (IdP).
Warning:
- If you're a member, billing manager, or outside collaborator to a private repository of an organization that requires two-factor authentication, you must leave the organization before you can disable 2FA on GitHub.com.
- If you disable 2FA, you will automatically lose access to the organization and any private forks you have of the organization's private repositories. To regain access to the organization and your forks, re-enable two-factor authentication and contact an organization owner.
Note: You can reconfigure your 2FA settings without disabling 2FA entirely, allowing you to keep both your recovery codes and your membership in organizations that require 2FA.
Configuring two-factor authentication using a TOTP mobile app
A time-based one-time password (TOTP) application automatically generates an authentication code that changes after a certain period of time. We recommend using cloud-based TOTP apps such as:
Tip: To configure authentication via TOTP on multiple devices, during setup, scan the QR code using each device at the same time. If 2FA is already enabled and you want to add another device, you must re-configure your TOTP app from your security settings.
-
Download a TOTP app.
-
In the upper-right corner of any page, click your profile photo, then click Settings.
-
In the "Access" section of the sidebar, click Password and authentication.
-
In the "Two-factor authentication" section of the page, click Enable two-factor authentication.
-
Under "Setup authenticator app", do one of the following:
- Scan the QR code with your mobile device's app. After scanning, the app displays a six-digit code that you can enter on GitHub Enterprise Cloud.
- If you can't scan the QR code, click enter this text code to see a code that you can manually enter in your TOTP app instead.
-
The TOTP mobile application saves your account on GitHub.com and generates a new authentication code every few seconds. On GitHub Enterprise Cloud, type the code into the field under "Verify the code from the app".
-
Under "Save your recovery codes", click Download to download your recovery codes to your device. Save them to a secure location because your recovery codes can help you get back into your account if you lose access.
-
After saving your two-factor recovery codes, click I have saved my recovery codes to enable two-factor authentication for your account.
-
Optionally, you can configure additional 2FA methods to reduce your risk of account lockout. For more details on how to configure each additional method, see "Configuring two-factor authentication" and "Configuring two-factor authentication".
Configuring two-factor authentication using text messages
If you're unable to configure a TOTP mobile app, you can also register your phone number to receive SMS messages.
Before using this method, be sure that you can receive text messages. Carrier rates may apply.
Warning: We strongly recommend using a TOTP application for two-factor authentication instead of SMS, and security keys as backup methods instead of SMS. GitHub Enterprise Cloud doesn't support sending SMS messages to phones in every country. Before configuring authentication via text message, review the list of countries where GitHub Enterprise Cloud supports authentication via SMS. For more information, see "Countries where SMS authentication is supported".
-
In the upper-right corner of any page, click your profile photo, then click Settings.
-
In the "Access" section of the sidebar, click Password and authentication.
-
In the "Two-factor authentication" section of the page, click Enable two-factor authentication.
-
At the bottom of the page, next to "SMS authentication", click Select.
-
Under "Setup SMS authentication", select your country code and type your mobile phone number, including the area code. When your information is correct, click Send authentication code.
-
You'll receive a text message with a security code. On GitHub Enterprise Cloud, type the code into the field under "Verify the code sent to your phone" and click Continue.
-
Under "Save your recovery codes", click Download to download your recovery codes to your device. Save them to a secure location because your recovery codes can help you get back into your account if you lose access.
-
After saving your two-factor recovery codes, click I have saved my recovery codes to enable two-factor authentication for your account.
-
Optionally, you can configure additional 2FA methods to reduce your risk of account lockout. For more details on how to configure each additional method, see "Configuring two-factor authentication" and "Configuring two-factor authentication".
Configuring two-factor authentication using a security key
After you configure 2FA, using a time-based one-time password (TOTP) mobile app, or via text message, you can add a security key, like a fingerprint reader or Windows Hello. The technology that enables authentication with a security key is called WebAuthn. WebAuthn is the successor to U2F and works in all modern browsers. For more information, see "WebAuthn" and "Can I Use."
On most devices and browsers, you can use a physical security key over USB or NFC. Most browsers can use the fingerprint reader, facial recognition, or password/PIN on your device as a security key as well.
Registering a security key for your account is available after enabling 2FA with a TOTP application or a text message. If you lose your security key, you'll still be able to use your phone's code to sign in.
-
You must have already configured 2FA via a TOTP mobile app or via SMS.
-
Ensure that you have a WebAuthn compatible security key inserted into your device, or that your device has a built-in authenticator such as Windows Hello, Face ID, or Touch ID. Most computers, phones, and tablets support this as an easier-to-use alternative to physical security keys.
-
In the upper-right corner of any page, click your profile photo, then click Settings.
-
In the "Access" section of the sidebar, click Password and authentication.
-
Next to "Security keys", click Add.
-
Under "Security keys", click Register new security key.
-
Type a nickname for the security key, then click Add.
-
Following your security key's documentation, activate your security key. If using an authenticator that's built into your device, follow the activation instructions from your operating system. You may need to select options such as
Face
,PIN
, orbuilt-in sensor
to access your device's authenticator, depending on your operating system and browser. -
Confirm that you've downloaded and can access your recovery codes. If you haven't already, or if you'd like to generate another set of codes, download your codes and save them in a safe place. For more information, see "Configuring two-factor authentication recovery methods."
Configuring two-factor authentication using GitHub Mobile
You can use GitHub Mobile for 2FA when signing into your GitHub account in a web browser. 2FA with GitHub Mobile does not rely on TOTP, and instead uses public-key cryptography to secure your account.
Once you have configured a TOTP application, or SMS, you can also use GitHub Mobile to authenticate. If, in the future, you no longer have access to GitHub Mobile, you will still be able to use security keys or TOTP applications to sign in.
- You must have already configured 2FA via a TOTP mobile app or via SMS.
- Install GitHub Mobile.
- Sign in to your GitHub Enterprise Cloud account from GitHub Mobile.
After signing in, you can now use your device for 2FA.