Sourcetree gitlab ошибка аутентификации

GitLab Forum

Loading

{lang: ‘ru’}

На работе для взаимодействия с git-репозиторием мы используем SourceTree. Один раз он был сконфигурированным, и больше я в настройки не заходил. Но 20 сентября стала доступна новая macOS Sierra. Я долго откладывал обновление, боясь, что после этого что-нибудь обязательно сломается… В общем, так и получилось. SourceTree перестал подключаться к репозиториям и выдавал ошибку аутентификации:

Permission denied (publickey)

В git мы авторизуемся по ключу. После обновления файл ключа находился в том же месте, что и до этого, его содержание тоже совпадало с тем, что было экспортировано в GitLab. После некоторого гугления выяснилось, что SourceTree по умолчанию использует при подключении тот ключ, который добавлен к ssh-агенту. После установки новой macOS эти настройки сбросились и ключ, естественно, не задействовался.

Проверить, какие ключи добавлены к агенту, можно с помощью следующей команды в терминале:

Если нужного ключа не окажется в списке, нужно его добавить с помощью

После этой нехитрой процедуры мой SourceTree без проблем смог подключиться к GitLab.

Полезная статья? Их будет больше, если вы поддержите меня!

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.

  • git
  • gitlab
  • atlassian-sourcetree

asked Nov 7, 2018 at 7:13

VK1's user avatar

VK1VK1

1,6764 gold badges28 silver badges51 bronze badges

3 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

B25Dec's user avatar

B25Dec

2,3015 gold badges31 silver badges54 bronze badges

answered Nov 8, 2018 at 7:58

David Planella's user avatar

David PlanellaDavid Planella

2,3132 gold badges25 silver badges30 bronze badges

12

  • Which SourceTree version are you using?

    Nov 8, 2018 at 8:12

  • And there is no way to reenter the password there?

    Nov 8, 2018 at 8:15

  • I figured it out. I didn’t read carefully. Thanks for your patience.

    Nov 8, 2018 at 8:18

  • Heads up: instead of «refresh token», just add a new user to your source tree users section and use the «Personal Access Token» created on the Gitlab website as a password

    Mar 28, 2019 at 14:49

  • All thanx to @marcelosalloum who find out that personal access token should be used instead of passwrd.

    May 7, 2020 at 8:13

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/

answered Jan 28, 2022 at 10:19

Madalina's user avatar

2

  • Solved for me. Thanks a lot!

    Aug 24, 2022 at 12:36

  • This solution doesn’t work for me but i solved it by — Replacing the Host by : gitlab.com — username : your gitlab username — password : your personnal access_token availiable on gitlab more on this link : docs.gitlab.com/ee/user/profile/…

    Oct 12, 2022 at 10:16

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.

answered Oct 23, 2019 at 18:54

Amrit Sidhu's user avatar

Amrit SidhuAmrit Sidhu

1,8801 gold badge18 silver badges32 bronze badges

I am trying to clone a git repo that is currently configured using SSH public/private keys rather than passwords. I can SSH into this using PuTTy and have used the following command to generate the keys (its a Unix based server).

$ ssh-keygen -t rsa "john@mysite.com"

This generates as you would expect the two files within my .ssh/ directory.

The issue I am having is basically trying to clone this same git repo to my local Windows desktop through a common git client like SourceTree.

When I try to check out via SourceTree it says the following :-

SSH Authentication Failed
Your SSH agent (Pageant) is running but the server still rejected your connection...

I have Pagent installed but unsure what to do from here? Any ideas…

— update —
When I open the private key on the remote server this is the structure (obviously longer & i’ve changed it for security purposes…)

-----BEGIN RSA PRIVATE KEY-----
MIIEoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-----END RSA PRIVATE KEY-----

Go to Tools -> Options in SourceTree and then go to the Authentication tab on the Options popup. Delete all of the stored passwords. Try again, you should have another opportunity to enter authentication credentials.

How do I fix git authentication failed?

It happens if you change your login or password of git service account (Git). You need to change it in Windows Credentials Manager too. type “Credential Manager” in Windows Search menu open it. Windows Credentials Manager->Windows Credential and under Generic Credentials edit your git password.

How do I set credentials in SourceTree?

PS: Sourcetree is a Wrapper around terminal git, fix the terminal = fix the wrapper. After that try to pull from your existing repository. It will then ask you for new username and password. Put your changed password.

How do I authorize in SourceTree?

Set up SSH keys.

  1. Check for Existing Remote Repositories. Select the Remote tab in the Sourcetree application to check for any existing repositories connected to accounts.
  2. Configure the Connection. Click the Add…
  3. Authorize Sourcetree to Connect to Your Bitbucket Account.
  4. Create a Private Git Repository on Bitbucket.

How do I change my SourceTree login?

Let’s do that now.

  1. Open the SourceTree app.
  2. Click the “Gear” icon in the top right corner and select “Settings”
  3. Click “Add Account”
  4. Hub: Select “GitHub”
  5. Username: (Enter your GitHub username)
  6. Password: (Enter your GitHub password)
  7. Protocol: Select “SSH”
  8. Click “OK”

How do I connect SourceTree to Azure DevOps?

Connecting Atlassian SourceTree With Your Azure DevOps GIT Repo

  1. Create a PAT in Azure DevOps (more info)
  2. Make sure you copy the generated PAT as you won’t be able to view it again.
  3. On Source Tree, go to add account and select Azure DevOps.
  4. enter the generated PAT as username.

How do I re authenticate Git in terminal?

do these steps in Terminal:

  1. Delete current password saved in your Mac git config –global –unset user.password.
  2. Add your new password by using this command, replace with your new password: git config –global –add user.password

Why is Github authentication failing?

The most common cause of this error is that you have inserted an invalid username or password. Before you try any other solution, make sure you have correctly typed in your username and password to authenticate to the Git server.

How do I reset my SourceTree credentials?

  1. First close any open instances of SourceTree.
  2. As Pathfinder, pointed out, SourceTree stores some of the passwords using the Windows Credential Manager.
  3. Go to Control Panel > User Accounts > Manage Credentials > Windows Credentials.
  4. Find any offending passwords and remove them.

How do I reset my git credentials?

Go to Control Panel > User Accounts > Credential Manager > Windows Credentials. You will see Git credentials in the list (e.g. git:https://). Click on it, update the password, and execute git pull/push command from your Git bash and it won’t throw any more error messages.

How do I link a Git repository to Sourcetree?

How do I connect Sourcetree to Azure DevOps?

What should I do if my Sourcetree requires authentication?

Navigate to C:UsersUSERNAMEAppDataLocalAtlassianSourceTree and delete (or rename) the file named passwd. Restart SourceTree and execute a command (e.g. Pull, Push, etc..) that requires authentication.

Why is source tree authentication failed to Bitbucket?

For Mac Users. There was a default account set on the Source tree which does not allow me to clone the URL because my current URL was of different bitbucket account. So, It shows the invalid source path and I then click on Advance Options and found Authentication failed to your_clone_url.

How to rewrite password in Atlassian Sourcetree?

Navigate to C:UsersUSERNAMEAppDataLocalAtlassianSourceTree and delete (or rename) the file named passwd. Restart SourceTree and execute a command (e.g. Pull, Push, etc..) that requires authentication. SourceTree will then prompt you for your password, rewriting the cached credentials.

How to fix Sourcetree can’t push problem?

You can find this in, Sourcetree -> Tools -> Options -> Git. Hope this helps. You must be a registered user to add a comment. If you’ve already registered, sign in. Otherwise, register and sign in. Updating my embedded copy of Git and telling SourceTree to use that fixed the problem for me. Thanks!

Понравилась статья? Поделить с друзьями:
  • Source filmmaker ошибка
  • Source code string cannot contain null bytes ошибка
  • Source 11 brakes ошибка
  • Sound booster ошибка
  • Soundwire ошибка 44100