Switching to 2 factor authentication in GitHub

When you switch to 2 factor authentication GitHub generates a 40 character Personal Access Token that you can use as a password to access Git repositories.

Create a Personal Access Token to use it as password in the command line tools

  • Log into GitHub and in the pull down at the upper right select Settings
  • On the left select Personal access tokens and click the Generate new token button
  • Enter a description for your token, so you can revoke it later in case of a  security breach
  • Copy the 40 character long token and use it as your password on the command line.

Update your username or password in the Git credential helper

When you have already stored your password in the credential helper of Git and switching to 2 factor authentication, or just want to update your GitHub username or password

  • In the command line execute the following to instruct the Git client to ask for your username and password
    git config --global credential.helper wincred
  • The next time you will access the GitHub repository to fetch, clone or push changes the Git CLI will pup up a dialog box to ask your username and password.

Leave a Reply