Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I would like to add my gitlab account to sourcetree. Inside Preferences -> Accounts, I tried the 'add' button

host: GitLab.com Auth type: greyed out username xxxxxx password: xxxxxx protocol: https 

when I go to save. I get a pop up screen that says: "We couldn't connect to GitLab with your (XXXXXX) credentials. Check your username and try the password again."

I've double checked both username and password.

like image 705
VK1 Avatar asked Nov 07 '18 07:11

VK1


People also ask

How do I authenticate GitLab in SourceTree?

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.

How do I fix Authentication error in SourceTree?

Ensure you are using an app password and that it is also correct (ensure there is no copy and paste error when copying the app password over to Sourcetree for Windows). Ensure Preferred Protocol is set to HTTPS. Hit Refresh Password. Make sure the page shows Authentication OK with the green checkmark, then hit OK.

Does source tree work with GitLab?

To connect SourceTree with GitLab.com, you can either use SSH or create a personal access token. Personal access tokens let you authenticate with GitLab over HTTPS with 2FA. To create a personal access token: Load https://gitlab.com/-/profile/preferences to access your user profile settings page.


1 Answers

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

like image 148
David Planella Avatar answered Sep 23 '22 15:09

David Planella