SourceTree keeps asking for Github password

Abigail Fox picture Abigail Fox · Jul 20, 2016 · Viewed 24k times · Source

My organization is switching from Bitbucket to Github for project management. Today, I was trying to transfer our most recent project from Bitbucket to Github, by using SourceTree. I added a second remote repository to the project (using the URL of the destination repository on Github), brought everything up to date, and then attempted to push the code to the repository. A box popped up, asking for the password to my Github account. I entered in my (correct) password, and clicked 'OK', and the dialog box popped up again. I entered in my password (correctly) again, and it did the same thing.

My username is correctly identified, my password is correct, and I tried updating SourceTree because I had heard that it was an issue with a previous version. The problem persists.

I am using SourceTree 2.3.1

Answer

Chris picture Chris · Jul 21, 2016

If you are using two-factor authentication with GitHub you will need to create a personal access token and use it with SourceTree:

To work with GitHub's two-factor authentication in SourceTree you can simply use your access token instead of your password. The steps to do this are as follows:

  1. Go to your Personal Access Tokens settings in GitHub.
  2. Click on the Generate new token button.
  3. Name the token something descriptive.
  4. Select which scopes you wish to grant this token.
  5. Click the Generate token button.
  6. Copy the token and use it as a password in your hosted repositories.

You can find more information about this on GitHub's help here.

Mac Users: If your SourceTree keeps on asking for the password, go to the Terminal and type this:

git config --global credential.helper osxkeychain