Hi all,
I have tried using the personal token access method and SSH key method but unable to connect gitlab via sourctree. It keeps throwing an error saying 'Authentication Failed'. I am not sure how to proceed with this. Any help will be appreciated.
I created a personal access token and copied the password to a local file. Pasted the password when prompted through 'Refresh PAT' and this throws an error 'Authentication failed'. I am not sure what the root cause for the problem is. Any help will be greatly appreciated thanks.
This is usually a credential-format or token-scope issue rather than a Sourcetree-only problem. For GitLab over HTTPS, GitLab says you can authenticate using a personal access token as the password, and if 2FA or SAML is enabled you must use a PAT instead of your normal password. [docs.gitlab.com]
In Sourcetree, use:
Do not use your GitLab account password as the password field. Atlassian Community answers for Sourcetree/GitLab also point out that the PAT should be used as the password when adding the GitLab account. [community....assian.com], [community....assian.com]
For clone/pull/push over HTTPS, GitLab documents these relevant scopes:
For Sourcetree account integration, many users report success with:
Atlassian Community and Stack Overflow examples specifically mention api and read_user, and some users resolved the issue by adding repository scopes too. [community....assian.com], [stackoverflow.com]
When Sourcetree prompts during Refresh Personal Access Token, enter:
not your GitLab password. This is a common point of confusion in Sourcetree’s UI. [community....assian.com]
If you previously entered the wrong password/token, Sourcetree or Git may keep reusing it.
On Windows:
gitlab.comSourceTreegit:https://...Then reopen Sourcetree and try again with the fresh PAT.
Before troubleshooting Sourcetree further, test the same credentials with Git directly:
When prompted:
If this fails too, the problem is likely the token, scopes, username, repository permission, or GitLab URL.
For SSH, make sure:
If the remote still starts with https://, SSH keys will not be used.
Create a new PAT with:
Then remove cached GitLab credentials from Windows Credential Manager and add the GitLab account again in Sourcetree using your GitLab username and the PAT as the password.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.