Two years ago, I set up two factor authentication for my gmail account. Last year, github announced the ability of two factor. I hadn’t noticed at the time. Today, I logged on to change my password since github was in the list of applications affected by Heartbleed and saw the option.
How it works
Github gives you a choice of second factor
- Google Authenticator mobile application (I already had the iPad app installed for gmail so this was convenient)
- text to mobile phone (I have this set a secondary)
- written down one time use passwords (kept as tertiary)
Linking the mobile app to github
- Open the mobile app
- Click “edit” pencil
- Click “+” to add an account.
- On your computer, go to your github account settings and click to enable two factory. You will be given a QR code to scan which automatically links the two. There is also the option of typing in a long text code.
That’s it. Now Google Authenticator generates two numeric codes. One for gmail and one for github.
Actually using two factor
Unlike gmail, you probably don’t usually sign on two github using the browser. Let’s look at three ways of signing in.
Through the browser
- I immediately logged out in the browser.
- Enter my password to sign back in
- Enter my two factor code
Through the github Mac app
- Github > Github preferences
- Click sign out
- Enter my username/password to sign back in
- Enter my two factor code
Through the command line
- On the account settings page, create a new personal token
- Leave the default privileges checked. (It’s great there is this much control)
-
git credential-osxkeychain erase
- git pull (or any other operation that requires a network call to github)
- Enter your user id
- Enter your new generated token (not your password)
Current apps
As you might expect, the account settings page shows which apps have access. I saw “GitHub for Mac” and “GitHub for Windows” on there. My first thought was “I don’t use Windows.” Then I remembered that I use git to communicate between my Mac and Windows VM.
Github references
- Main two factor help page.
- How to provide your two factor token
- How to store your second factor for command line use
Web service
I also had to update my web service code to call the two factor version.
Action items
If you haven’t already, please change your passwords for sites in this list or enabling two factor will protect you in the future. Also change your passwords for any sites which use the same password as one of those in the list.