Skip to content

Instantly share code, notes, and snippets.

@foucdeg
Last active March 7, 2018 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save foucdeg/86b64890ecb6e0fd139544533205a747 to your computer and use it in GitHub Desktop.
Save foucdeg/86b64890ecb6e0fd139544533205a747 to your computer and use it in GitHub Desktop.

How to setup 2FA on Github in 2 minutes

  1. On your computer, go to your Github security settings. You might be asked your GitHub password.
  2. Click "Set up two-factor authentication" then "Set up using SMS".
  3. Fill in your phone number, wait for the text message on your phone, and fill it in on the computer.
  4. Download and store your recovery codes safely (ex. password manager, KeePass, locked note, printed page ...)
  5. Click Enable to activate 2FA.

You're done! 🔒 👍 😌

Nice to have: Authenticator app

Later, you can reconfigure your 2FA to use an app like Google Authenticator for iOS or Android. It's faster than waiting for an SMS to arrive.

After reconfiguring, don't forget to add your phone number as a fallback. You will need it to reconfigure 2FA every time you get a new phone.

Help!

Can't pull or fetch anymore?

You can no longer use command-line Git with a password authentication mode. If you were using Git over HTTPS, change your git config to use a SSH remote :

git remote set-url origin git@github.com:<org>/<repo>.git

If SSH isn't possible, you can get a personal access token from Github (choose repo as the scope) and use it instead of your password. With the token, pushing and pulling will succeed.

What to do if you've lost your phone

Until you get a new phone, find your recovery codes. If you get logged out from your computer, you can log back in that way.

If you also lost the use of your phone number for some reason, the recovery codes are your last option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment