Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Adding a github personal access token to sourcetree

I've recently used sourcetree for the first time in over a year.  I'm getting a message from github that I need to use a personal access token.  I've got to github and created the token.


But...  I cannot figure out how to update sourcetree to use the token.  What steps do I take (I'm on windows if that matters)?

6 answers

I just found the answerr in case you haven't. Im also using windows.

  1. you can generate the Personal Access Token first from github
  2. You can remove your github credential first from 'Credential Manager' as mentioned here:
  3. you can try to do like push so sourcetree will ask for your credential and you can enter your id and PAT in the password part
  4. BUT. if there's no cred confirmation window prompted, you can manually remove the id from the 'passwd' file as mentioned here:,you%20for%20your%20credentials%20again.
  5. delete the id line in that file then save
  6. try to push again in your sourcetree, but this time it'll definitely ask for you credential
  7. add your id & PAT
  8. DONE! <3 hope this helps.

Makes me want to learn git via CLI, instead.

Spent three hours trying to make SourceTree work with GitHub.  Scouring message boards, endless Googling, trying half a dozen solutions and none of them working.

Downloaded GItKraken and I was back to work five minutes later.

I installed GitHub Desktop and it was working out of the box.

Not clear how a company like Atlassian keeps SourceTree so hard to operate for a basic feature.

Why should I search forums on how to solve a basic issue like connecting to GitHub using a token? Atlassian should update SourceTree to have a clear way to integrate with GitHub using an access token.

I believe it's that SourceTree lets you control which version of Git you are using. So, for me, I was using an older version before Git even implemented tokens. So the app allows for flexibility, but this also brings complexity when the underlying features change. 

Like majew7 likes this

And their attitude really is: if you don't like it, then don't use it.

It's really a love/hate relationship that they maintain with their user base.

Thanks for the GItKraken  recommendation!

I wasted four hours tonight wrestling with installing SourceTree on a new machine only to find out that it's solution RE: PAT's is insecure (it actually shows the PAT!).

This was the final straw. Goodbye SourceTree.

I had a similar issue on my Mac (Big Sur):

  • Yes; Git with personal access tokens setup via Mac's Keychain Access worked fine at command-line (e.g. iTerm2).
  • No; SourceTree would throw errors about missing my personal access token for simple operations like pulling.


My Solution

Configure SourceTree to use "System Git".  Just select "Use System Git" to select the Git version which is installed on your system.   

Using Embedded Git or System Git in SourceTree 

Thus, the issue seems to have gone away in SourceTree, since my System Git is properly reading from my Mac's Keychain Access, and SourceTree is no longer using the Embedded Git.

There are many different issues you might face.

We have tried to dig into each of them and resolve them all finally.

This article could be helpful for you:

According to this article - - you can create your personal access token and then use that in lieu of your password within SourceTree.

The question is how do I tell SourceTree to use that token?  I cannot find an option to change the password SourceTree uses when it accesses github.

In my version, it's Tools > Options > Authentication (tab) > That sets it globally.

If you need to change it per repository, you can choose Repository > Repository Settings > Advanced > User Information

Like Rob Howe - IWP likes this

I tried that and still can't get in.

Like Lee Swee Ling likes this

Follow this solution working for me! Thanks a lot for sharing!

Like Amanda Giles likes this

same issue..

mmm I have the same issue too

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Sourcetree

Bug Fix: Sourcetree for Windows authentication error when updating to app password

Hello Sourcetree users!!! With the recent removal of Bitbucket Cloud account passwords for app passwords (please see our Bitbucket Cloud community post for details on why we made this change for se...

60,428 views 127 26
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you