Cannot access GitLab on Sourcetree 3.0.6
Asked by anta40:

I've successfully added my GitHub account on Sourcetree.

![stg.jpg](/t5/image/serverpage/image-id/35611i9AD56E491DD0C5A5/image-size/large?v=v2&px=999 "stg.jpg")

Next is GitLab. On the Edit Hosting Account, I clicked the Refresh Personal Access Token button. A dialog would appear, asking my GitLab username \& password. I entered the correct input, and the result was "Failed to check login for user \[\]". Now I'm confused.

I'm on 64-bit Windows 10, BTW.


Answers:
author: minnsey
body: Hi   

GitLab REST API only works with Personal Access Tokens <https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html>  

The UI uses a shared component to gather the password/token hence the wording, but we will review that.

comments: author: anta40
body: ++OK, I created another GItLab access token.++

++![gtk.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/35695i6E16A1765A339155/image-size/large?v=v2&px=999 "gtk.jpg")"Authentication failed" still happens. Maybe I miss something?++


author: tinix84
body: name: name of token

psw: Your New Personal Access Token


author: Naphier
body: This is super un-intuitive as the UI looks like it's asking for your gitlab user name and pw, NOT the access token name and token...

Silly


author: minnsey
body: 3.1.2 has improved wording in this username/password/PAT dialog


author: Matthew Cross
body: Hasn't seemed to have improved anything. Crashing constantly here trying to connect to Gitlab.


author: madsmads
body: When I changed the **protocol** from HTTPS to **SSH** in SourceTrees account setup, it seems to stop crashing.  

<br />


author: Victor_De_Los_Santos_Bernad
body: Well I cannot make sourcetree to authenticate a gitlab account. I am connecting to a Gitlab CE. Tried using both my account password and the token as password with no avail. :S

comments: author: hugobalbino
body: I have the same problem... using sourcetree 3.1.2 and trying to connect in remote repository GitLab Community Edition 8.7.0...

I tried using my userID and my password... tried using my userID and PAT... tried using username in blank and PAT... no success...

I make a success test connecting to Gitlab API using SoapUI and PAT... so the API is working, the problems seems to be in sourcetree.

When try to connect o got "Authentication failed" message...

Anyone how to solve it?

![Sem t?tulo.png](https://community.atlassian.com/t5/image/serverpage/image-id/53123i276D458FACABBA55/image-size/large?v=v2&px=999 "Sem t?tulo.png")


author: slaughton
body: I am using Source Tree 3.0.15 and eventually got this working by using Gitlab CE, username and token for password.

comments: author: mauriciopena123
body: Thanks!


author: thanh
body: I still have the problem. Gitlab.com, Sourcetree 4.0 (232) on macOS Catalina. So, how does this work?


author: Stefan Gavranovic
body: 3.1.3 Still not working


author: Yu-Cheng Li
body: Same here. Sorucetree 3.1.2 still Not working.


author: Dan
body: Same here. 3.1.2 Not working.


author: rj moris
body: still not working 3.12 sorucetree


author: Karolis Pocius
body: still the same


author: Michalis Dobekidis
body: can't get it to work. Adding my gitlab username and the personal access token but with no luck (on windows), it keeps showing the authentication failed. Also tried via the credential manager but nothing


author: Max Lav
body: I've chosen GitLab CE instead, used profile link, username, PAT and it works. If it doesn't, reinstall SourceTree and try again

comments: author: tr33c
body: Reinstalling it does not fix the problem for me. using PAT.  

Really not a fan of the billions of comments telling to use the PAT, for people that have a different issue it is virtually impossible to solve or get recognized.


author: Alireza_Motamedi
body: I had this problem but i solved it.

According to this url <https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html> :

-----

You can create as many personal access tokens as you like from your GitLab profile.

1. Log in to GitLab.
2. In the upper-right corner, click your avatar and select Settings.
3. On the User Settings menu, select Access Tokens.
4. Choose a name and optional expiry date for the token.
5. Choose the [desired scopes](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#limiting-scopes-of-a-personal-access-token).
6. Click the Create personal access token button.
7. Save the personal access token somewhere safe. **Once you leave or refresh the page, you won't be able to access it again.**

-----

Enter Sourcetree as Token Name

Read step 7 again. you have to copy your token somewhere. it's something like this:

![Ashampoo_Snap_Tuesday, March 24, 2020_00h02m52s_001_.png](https://community.atlassian.com/t5/image/serverpage/image-id/87588iF6529DDCB3AAD0E2/image-dimensions/576x348?v=v2 "Ashampoo_Snap_Tuesday, March 24, 2020_00h02m52s_001_.png")

Then in the edit hosting account dialog choose gitlab and https as protocol and then click on refresh personal access token button.

After that in the username and password dialog enter your gitlab username and **paste that token you copied it before as your password. Don't enter your gitlab password.**

**![Ashampoo_Snap_Tuesday, March 24, 2020_00h09m20s_002_.png](https://community.atlassian.com/t5/image/serverpage/image-id/87592i88E0CC8DAC2469C1/image-dimensions/573x500?v=v2 "Ashampoo_Snap_Tuesday, March 24, 2020_00h09m20s_002_.png")**


author: rubenCarrera
body: Solution: don't use Sourcetree with GitLab

comments: author: ucodrepo
body: Don't use Sourcetree at all!


author: Josef Micka
body: try to switch from embeded git to system git, that did solve problem for me. of course you need to have git installed in system.


author: ucola
body: Hey all

I found the solution...

If you connect over https, make sure you have an ending / on your URL! This works for me with 3.3.4 on Windows...


author: mdnorton
body: Using Sourcetree version 3.3.4 I am having massive issues with getting the client to authenticate with GitLab EE. GitKraken works fine with the PAT, and I can log in over browser to GitLab EE. I am reasonably certain since I can use another client and PAT authentication, that the trouble is Sourcetree.

I have generated the PAT with api, read_user. I create the account on Sourcetree under Tools \>\> Opetions \>\> Authentication \>\> Add.

Fields selected are "GitLab EE", the site URL, protocol HTTPS. Credentials are fixed at PAT and logging in with the GitLab account name and the PAT as password produces "Authentication failed." in the dialog box.

We had this working back in January but something has happened and this is an absolute showstopper as I have developers who are trying to get going with Git and GitLab (company's chosen repository software) and I cannot get them authenticated.

This is critical and I hope there is a debug method. I have not been able to find a console or any other debug method to get a more detailed error than Authentication failed and the stated way of accomplishing this is not working.

Please advise.


author: enrico
body: same here

sourcetree 3.1.3

GitLab 12.0.3

comments: author: jack
body: me too

Sourcetree 3.2.6


author: Matthias Kretschmar
body: I still have the problem. I tried with GitLab CE and GitLab EE, but with no success.

Protocol is HTTPS and URL looks like <https://SEVER.DOMAIN.TOPLEVEL>

In login dialog I entered my username and the PAT from <https://SEVER.DOMAIN.TOPLEVEL/profile/personal_access_tokens>


author: Jacqui Read
body: I was having this issue with 3.1.3 and it turned out I had chosen the wrong version of GitLab in the drop-down (so make sure you have chosen the correct one out of GitLab, GitLab CE and GitLab EE).

Once I had chosen the correct one, entering my GitLab username (i.e. the one after the @ when you click on your avatar in the top-right menu on GitLab) and the PAT (not my GitLab password) I was then authenticated.

comments: author: rubenCarrera
body: not working


author: Jo?o Jos? Salgado Serra
body: same here


author: minnsey
body: Hi  

We have some internal improvements to the GitLab account management going into beta testing today, we hope to be able to make it available to all users soon.

comments: author: mpalmero
body: has this issue been fixed? tx


author: Yevgen Horiachun
body: Sourcetree 3.0.15 bug reproduced

Created new token  
![new_token.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/41256i36810DA8AB6F5ADF/image-size/large?v=v2&px=999 "new_token.jpg")  
Add account in sourcetree   

<br />

![failed.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/41257i12D6542C439D687B/image-size/large?v=v2&px=999 "failed.jpg")


author: Mingyu Sang
body: same issue here..... Authentication failed


author: Mingyu Sang
body: oh I just made it. As soon as you create your token, you can see random letters and copy them. This will be your password. and Username is the name of token or your userID... Try both haha


author: minnsey
body: Interesting, thanks for the information we'll take another look at this.


author: tr33c
body: over 2 years later and still no answer?

We have a private server running gitlab community edition.  
Using my token as password still throws Authentication failed, with no explanation as to why. Other git clients work fine. I really wanted to use sourcetree.![SourcetreeHasIssues.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/146725iC0FEDEAAEB82DD32/image-size/large?v=v2&px=999 "SourcetreeHasIssues.PNG")  
Fix this, or at least give better feedback as to WHY it failed... I am 1000% sure I used correct credentials. I used the token, the token works with other clients, why not sourcetree.


author: Yevgen Horiachun
body: Sourcetree 3.0.8 bug reproduced