Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do I use a personal access token (PAT)

I got this from git:

We recommend using a personal access token (PAT) with the appropriate scope to access this endpoint instead. Visit https://github.com/settings/tokens for more information.

4 answers

1 accepted

1 vote
Answer accepted

Thank you.

8 votes
Manju Atlassian Team Jan 08, 2020

Please add your GitHub account on Sourcetree and use basic auth with PAT as your password and the username. 

Where do I find the place to add my GitHub account? And once there, I should list the PAT in both the username and password fields?

Like # people like this

You can edit your GitHub account via Sourcetree menu > Preferences > Accounts.

Use the PAT only as the password.

Like Lorand Palfalvi likes this

The key words that helped me is "use basic auth with PAT as your password". Thank you!!!

Like akamal360 likes this

When I try this I cannot connect during the GitHub brownout.

 

I am using:

Basic

Username: my GitHub username

Password: my PAT

Protocol: HTTPS

 

It was working using this for a couple of months until the Brownout

Hey having the same issue.

Have tweeted Atlassian and Github just now. Maybe add to it? My twitter handle is iOSBrett

I switched to Github Desktop until it's resolved

I'm having the same problem.

I couldn't connect during the GitHub brownout.

Like wetering_nictiz likes this
Like # people like this

I still have the issue even with enabled 2FA and with my username and PAT as password

Like m.nesvat likes this
m.nesvat I'm New Here Aug 13, 2021

Yes, I still have the same issue even though I passed the password as PAT like mentioned above!

Confirming that @wetering_nictiz 's link works! Change the URL in your repo settings to 

https://<USERNAME>:<TOKEN>@<GIT_URL>.git 
Like # people like this

For those who faced up with issue using PAT as password.
Try to clean your passwords as described here:

https://eekayonline.medium.com/connecting-mac-sourcetree-with-your-github-account-b6b3bb3c5a66

I've deleted some of my GitHub-files (and from Mac Keychain too) and it works now

Like eekay likes this

I am not sure what really helped but I know it works for me now, this is everything I've done in order:

1. Generated the PAT and used as password - didn't work.

2. Cleared the github.com entry in the Windows credentials manager - not working.

3. Added the PAT to the repository url like this

https://<personal-access-token>@github.com/<my-repo-url>

- it worked but I didn't like this solution.

4. Restarted PC, installed the newest git from https://git-scm.com - and in Sourcetree - Tools/Options/Git/Git Version - selected "System".

5. Removed the PAT from repository url - still works.

To me it looks like installing the new "git" really helped, so step 3 may be unnecessary, but I can't be sure about that, don't know if it would work without temporarily adding PAT to the url, maybe it also saved something somewhere.

Like # people like this

After a lot of searching and trying various fixes for PAT issues, this solution worked for me. With updated system git, the PAT works without being included in repo url. Given the funny behavior of the sourcetree settings authentication and entering the PAT as the basic auth password, I'm not sure where the PAT is being stored but it apparently is available without inclusion in the url. Seems to be working so far...

I still can't understand

My PAT is [redacted]

My repo URL is https://github.com/sulfur17/sulfur.common

My token note is New

My github user name is sulfur17

what should I write in URL in Source Tree?Снимок.JPG

iOSBrett I'm New Here Aug 29, 2021

I am not sure if this is a joke or phishing attempt.

But if not, you just gave everyone access to your repo by posting your credentials. A PAT is a password. You should remove this post and change your PAT ASAP

Like # people like this

thank you for your concern but I wrote this PAT only to be specific, and it's not my real PAT

Like # people like this

In that case, and this is not really good security practice, but it does work for me.

In the URL field:

https://sulfur17:[redacted]@github.com/sulfur17/sulfur.common

 

Alternatively as Atlassian is not really offering much support here, I am also considering switching away from SourceTree to GitHub Desktop. That works for me without having to add my PAT in plain text.

Oops, I keep replying from different accounts!

Like _d_ivanov likes this

Thank you! It finally works for me) 

No problems, this has been really frustrating hasn't it.

Also, I just copied it from @wetering_nictiz and @Ivo van der Marel 

Sorry for assuming that you posted your real PAT earlier

Updating to the latest system GIT fixed it for me.

0 votes

This was a really bad idea, much easier to use a competitor 

@Jarosław P solution worked for me. I had this working no problem on one computer and couldn't get it to work on another. After reading their comment I realized one computer was using embedded git (wasn't working) the other was using system git (was working). I switched to system git on both and no problem. No need to put any token in the URL -- could just use the normal HTTPS format

Great to hear that I could help :) This whole PAT in the URL was really bothering me, so when I found a way to fix it I had to share it.

Suggest an answer

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

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

7,098 views 5 13
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