In Sourcetree, when I select “GitLab.com” (private token auth type is selected by default), I enter my Gitlab username and password (SSH, id_rsa.pub). I cannot change the id_rsa.pub to the recommended ED25519 option.
Even though the correct user name and password are entered, I get the following error:
“Login error, We couldn’t connect to GitLab with your (username) credentials. Check your username and try the password again.”
I’ve tried connecting via Gitlab CE and also through HTTPS. Nothing seems to work though I can git commit via Terminal.
Has anyone else encountered this auth issue with GitLab? I was formerly on GitHub and didn’t have any issues with auth. I did enable 2FA if this causes problems with Sourcetree?
When “Private Token” is selected for “Auth Type” for connecting GitLab to Sourcetree, you actually need to enter a Personal Access Token in the “Password” field, not your regular password. Sorry for any confusion.
To generate a private token, navigate to https://gitlab.com/profile/personal_access_tokens, create an personal access token with scope of api, read user, and write repository, and use this in place of your password when connecting your account to Sourcetree.
For GitLab CE the steps to set up Sourcetree to use private token will be almost identical, the only difference being the URL to create the token to use in place of your password will use a different URL: <your_gitlab_url>/profile/personal_access_tokens
Please let us know if this resolves the problem for you, and don’t hesitate to ask if you have any questions.
Thanks @gitlab-greg. The token worked for adding the account but I’m now blocked on push/pulls. I get thrown this auth prompt and neither the token or GitLab password work:
HI @grehce it looks like the request here is for the password associated with your ssh key, not an access token or account password. I can tell this is the case because its requesting password for user git, not your username, and the error message in screenshot 2 is: git@gitlab.com: Permission denied (publickey).
Did you set a password when creating the SSH key affiliated with your GitLab account? If so, can you try entering that password in the prompt in your first screenshot?
Thanks @gitlab-greg. Weirdly, the Password prompt pops up twice when I enter the password associated with the SSH key which led me to initially believe that my password was incorrect because the prompt was thrown twice; however, if I enter the same password again, the pull successfully completes.
Is there a way to set the password so that I don’t have this password requirement on every push/pull?
I’ve done all of this, even managed to get my GitLab remote repos to display in SourceTree in on the remote tab… but when I try to clone one of my repos, then it errors: abort: repository <repo_name> not found
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)