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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


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

Authentication failed on Gitlab account adding



   It seems to be impossible to add an existing GitLab account to SourceTree. When requested for authentication, though using correct username and fresh password, it continuously fails.


   Any suggestions that doesn't involve using a different repo provider?

9 answers

1 accepted

3 votes
Answer accepted
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Feb 21, 2019


You need to use a Personal Access Token

We are improving the text on those dialogs to reflect this

Thanks for the suggestion. I should have elaborated the steps that lead to the issue.

In first instance, an attempt to text copy the personal token from Gitlab to Sourcetree proved impossible to accomplished. The text box for the personal token was present but completely inactive, making impossible to write and/or copy text.

The next step was to click on the Refresh Personal Token. This popped up a login window, which lead to the authentication issue.

Any options to introduce the Personal Token?


Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Feb 21, 2019 • edited

Sorry, to clarify.

yes you need to click on the Refresh Personal Access token and then in that popup dialog enter your username and use the PAT as the password there.

Is this what you were doing and you still got the error?

Like # people like this

I proceeded as you suggested and that worked smoothly. Thank you very much!


I would suggest changing the UI and messaging a little. The whole thing is a bit misleading.

Like Grace Chang likes this
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Feb 26, 2019

Yes, some small improvements are already in progress

Hi, i've same problem using SourceTree 3.1.2 (216) but i no have a Refresh Personal Access token button !

How can i do ?


Like # people like this

Since this question has been marked as Solved but the problem still exists for later Sourcetree versions, or for Sourcetree on Mac, or both together, I have opened a new question to address the remaining problem here.

Solution found: enter your personal access token as the password. Do not enter your GitLab password.

It's not clear to me which scopes are required for the personal access token in this case. I used "api" and "read_user" and they worked for me.

Like # people like this

Entering the token helps with the Account add for Sourcetree; however, when you push/pull changes, you get the following prompt and the token doesn't clear this password requirement:


Screen Shot 2020-08-19 at 9.30.17 AM.png

Screen Shot 2020-08-19 at 9.31.19 AM.png

Angus Freeman
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 21, 2023

This works, but only for ONE gitlab account. If you have to sign into more than one gitlab account, you will constantly be kicked out of the previous one as soon as you refresh credentials for another one. How can you down vote this "accepted" answer?

1. Go to this link and create a personal access token

2. From source tree, Tools/Option.  Click Authentication tab, add account, choose gitlab and enter username as name of personal access token, password is Personal Access Token. 

=> Done

WTF!! this workarround works!

We put password as access token and our username and works fine.

I'm using 3.1.2 on a Mac and running into this same issue, except I don't see Tools / Options anywhere within Sourcetree and no option to Refresh PAT. Please help!

Hi joseposes22, I'm using 3.1.2 on my windows 10. I've tried your method, but it didn't work. 

For me it didn't work too.

Unable to find Refresh Personal Access token button on SourceTree 3.1.2 (225).
How Can we do?
Team , Please look into this asap.

Screenshot 2019-07-12 at 8.22.26 PM.png

The solution was (on Mac):
- revoke the old Access Token from GitLab (which had only the next Scopes: read_repository, write_repository)
- generate new Access Token having the next Scopes: api, read_user, read_repository, write_repository (it was strange that for other colleague it worked only with read_repository, write_repository)
- on SourceTree: go to SourceTree -> Preferences ->Accounts -> Add -> fill-in the details as in the following image (and for Password use the Access Token):
After this, I was able to Clone Repository ("Clone from URL").

I'm now able to add the account with the token hack; however, on git push/pull I get a password request where neither my Gitlab password or token works.

It turns out the prompt is asking for the `ssh` password, see Gitlab support thread here:

not working at all. i even removed all auhentication fields, yet when i try to push my code to gitlab repo i get basic auth failed, you need access token.


i did setup access token, my access token has FULL access.


in old 1.9 source tree same token works flawless, but in new fugly 3.x nothing works. removing all account restarting git, doesn't work. adding manually account to setting (which creates 2 entries, one for basic auth, and one account) doesn't work. yes PAT refresh token says SUCCESS but PUSH to repository always fails.


guys can you finally fix this? 


it's huge pain, and whenever i forget to decline upgrade to 3.x shit. i need to revert back to 1.9 to get working git client.

ok small update (i found this, when i was solving another problem - after update terminal didn't work - switching to "system" git instead of embeded git solved not only terminal problem, but also "authentication" issue)

so authentication doesn't work with embeded git, but does work with system git.

Like Aaron Gerston likes this



I have system git version selected...


I use GitLabEE, and when I refresh Personal Access Token and I put my GitLab username y the PAT generated token from GitLab, it does not work.




So, it is impossible to connect. Please, could anyone recommend me another tool, NOT Sourcetree? Thanks!!

Like Thuy_Doan likes this

I created a new token, using my username like name of token and when I tried to login in sourcetree, in my password I type thisasdadadsad.PNG

And my login was successful

Deleted user Jun 05, 2020

After more than a year, it's still an issue that forced me to google and waste 30min of my time reading discussion threads! 

If anyone else can't resolve this, of course follow @Quy Ho's instructions, but also make sure you're choosing the correct GitLab Hosting Service. Mine was GitLab CE and I spent some unnecessary time trying to log in with GitLab.

GitLab EE ended up working for me. Thanks!

Hi, I would like to recommend to all guys this link and it works for me

As I know, this resolved my issue when I put my PAT as password and username for login. But it seems to not working because it is missing api scope.

It’s probably late, but hopefully it helps you.

0 votes
John McKiernan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jul 29, 2020

Hi all, 

Just wanted to update this thread to let you know there is now a native automation trigger for GitLab with Jira Cloud. We are running a webinar soon to walk through how it works and show some use cases in how to automate from Gitlab to Jira. Feel free to register here:


Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events