Stuff that interests me
Thoughts about software development and other things
Thursday, 30 August 2018
On remote working
Rock at working remotely
Sharing your office with under fives
Saturday, 11 June 2016
Using two factor authentication with GitHub on Windows - the easy way
Two factor authentication is great but until recently I’ve had numerous problems getting it to work with repositories on GitHub. Happily I’ve found the easy way. This only applies to Windows users and only works over HTTPS, not SSH.
First install Chocolatey.
Now open a command line as an administrator and install two Chocolatey packages.
cinst git -y
cinst git-credential-manager-for-windows -y
That’s it. Git credential manager is where the magic happens. When you take an action on your repository, over HTTPS, you’ll be asked for your username, password and your two factor authentication code. Credential manager then automatically creates a personal access token with read/write permissions on that repository and stores the token. All subsequent git commands for the repository use the stored access token, no further authentication is required. Simple.