SourceTree keeps asking for Github password

50,573

Solution 1

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

Solution 2

I am using a SSH key, but SourceTree was asking me a password every time.

Found on the community of Atlassian, this solution worked for me:

  1. Open the terminal, get into your project directory
  2. Type git config credential.helper store
  3. Type git pull
  4. Input username/password (if asked)

Voilà !

Solution 3

Follow to @Chris answer in case you've enabled 2FA, to use Personal Access Token in SourceTree, you need to add your acc with this token in SourceTree > Preferences with following information:

  • Auth Type: Basic
  • Username: {your-github-account}
  • Password: {your-personal-access-token}
  • Protocol: HTTPS

After that, you are able to clone your Github repo.

enter image description here

Solution 4

A solution worked for me given by Andrew Magill, Copied from Source : link

The problem is that SourceTree's embedded Git client comes with git-credential-manager v1.12, which no longer works with Github since they disabled TLS 1.1 on their site. You need to get git-credential-manager v1.14. Easiest way to do that is to install a current copy of the Git client separately, and then switch SourceTree over to use that ("system git") instead of its embedded client. Alternatively, you can update git-credential-manager in your embedded client by replacing its files with the newest version from Microsoft.

Solution 5

I had a similar thing after an update; I tried re-adding my bitbucket credentials, changing the protocols, etc. with no luck, until...

  1. I opened my keychain and searched for bitbucket (probably the same for github, just search for github instead) under the Passwords category.

  2. I found that I had multiple Access Keys for my user, so I closed my repository, deleted all the keys of "application password" Kind, opened the SourceTree preferences > Accounts > removed my account and re-added it (login as usual - I used Basic with HTTPS).

  3. Keychain asks for permission to save the password, which I said yes and now I only see one key of the kind "application password".

I opened my repository from the repo browser and hey presto, no more password popups!

This bugged me for a whole week! If this helped you, you can do a little dance with me now :)

Share:
50,573
Abigail Fox
Author by

Abigail Fox

Updated on July 08, 2022

Comments

  • Abigail Fox
    Abigail Fox almost 2 years

    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