Updating SourceTree Git Login Credentials

At work we use Git for versioning our code. We also use the suite of Atlassian products for managing tasks, code, and deployment. As such I use SourceTree a lot to manage my code. We’re also security conscious and so we have to change our passwords every couple of months – however this then breaks SourceTree.

What I mean is, when I change my password SourceTree doesn’t remember the change and so I have to enter it every. single. time.

Having Googled how to solve this 3 or 4 times now I thought I’d make a note on my blog so I can more quickly find the solution (hopefully the act of writing it down will mean I won’t have to Google it again).

The solution is actually quite simple once you realise – but doesn’t use any of SourceTrees dialogs.

  1. Open SourceTree and navigate to the repository you want to update the password of
  2. Click the ‘Terminal’ button to jump to the location of the repo on the command line
  3. Enter ‘Git Pull’ and hit return to update the repository
  4. When requested enter your password
  5. Done

Posted in: Tips, Web Design

12 thoughts on “Updating SourceTree Git Login Credentials Leave a comment

  1. Hi,

    I tried this but it doesn’t work at all. Every time I do a git pull or push in the terminal, it keeps asking me for username and password which is quite annoying. What version of Sourcetree are you using?

  2. Thank you for this! If you’re working on a Mac, like I am, I think this updates the credentials correctly in Keychain Access. I tried to do it manually but it didn’t seem to work until I followed your steps.

  3. I know this is a really old post. But I deleted the references in keychain, restarted SourceTree, it asked for password and now it’s all good.

  4. @Ben, I also appreciate that this is an old post, and I followed your instructions, but the problem persists for me. I noticed that when I enter my credentials on the command line, there is a keychain entry for tfs.host.com, but when I enter them in SourceTree there is a new keychain entry for tfs.host.com:8080. Yet, SourceTree asks me for my password multiple times each time I pull.

    I’m on SourceTree 2.3.1, Mac OS 10.11.6.

    1. Must admit I haven’t tried to do this in a long time. I now have Github Desktop installed for Github and SourceTree for everything else. Just makes it simpler 🙂

  5. Where does the Authentication cache information is stored in source tree.
    when user is trying to push to GitLab it is taking wrong user id and trying to push

  6. THANK YOU!
    Git pull did not work because I had already cloned and had the latest. However was able to add a commit and then issue Git Push. Was prompted for User Name and Password.

    Note that if you have 2FA on your github account, you will need to use Personal Access Tokens instead of password.

Leave a Reply

Your email address will not be published. Required fields are marked *