SourceTree gives me a login Error when I try to add my gitlab account

I am adding some advantage to @David's answer. Follow whatever steps he has mentioned but remember to select all scopes while creating a personal token.


PROBLEM SOLVED

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):

enter image description here

After this, I was able to Clone Repository ("Clone from URL").

Also, this link inspired me: https://www.awordfromnet.com/access-gitlab-via-sourcetree-updated/


Someone on the GitLab forum had a similar issue recently, and they documented the steps to solve it:

I eventually noticed that for github and bitbucket the credentials are through "Oauth", and for GitLab "Personal access token". I had generated yesterday a toke, but hadn't used anywhere.

Steps to add a repo from GitLab on SourceTree:

  1. On your browser, go to your account and > User settings > Personal Access Tokens (https://gitlab.com/profile/personal_access_tokens)
  2. Generate and copy the token
  3. On Sourcetree,

    a) leave https as preferred protocol

    b) click on Refresh Personal Access Token

    c) type your username

    d) use the copied token as password

Refer below image enter image description here