Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do I use a personal access token (PAT)

Richard Albrecht January 7, 2020

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.

5 answers

1 accepted

3 votes
Answer accepted
Richard Albrecht January 8, 2020

Thank you.

8 votes
Manju
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 8, 2020

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

Annie Olsen June 4, 2020

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
Robin Stewart December 19, 2020

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

Use the PAT only as the password.

Like # people like this
Vitaly Popov May 20, 2021

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

Like akamal360 likes this
Brett May June 30, 2021

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

sonali_sharma June 30, 2021

Hey having the same issue.

Brett May June 30, 2021

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

Brett May June 30, 2021

I switched to Github Desktop until it's resolved

LeeChernWai June 30, 2021

I'm having the same problem.

I couldn't connect during the GitHub brownout.

Like wetering_nictiz likes this
Like # people like this
TuoZios August 11, 2021

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

Like Deleted user likes this
Deleted user August 13, 2021

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

Ivo van der Marel August 14, 2021

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
thepoortom August 15, 2021

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
Jarosław P August 18, 2021

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
Richard Corn August 26, 2021

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...

_d_ivanov August 29, 2021

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 August 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
_d_ivanov August 30, 2021

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
Brett May August 30, 2021

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
_d_ivanov August 30, 2021

Thank you! It finally works for me) 

Like atom888 likes this
Brett May August 30, 2021

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

Like atom888 likes this
maybites October 9, 2021

Updating to the latest system GIT fixed it for me.

1 vote
Divya Jeganathan October 13, 2022

Go to repository settings. In the remote tab click the origin and change the value as https://<token_name>:<personal_access_token_value>@<git_url> 

1 vote
billMolloy December 15, 2021

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

1 vote
gfreeman191 November 13, 2021

@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

Jarosław P November 13, 2021

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
AUG Leaders

Atlassian Community Events