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

not working at all. i even removed all auhentication fields, yet when i try to push my code to gitlab repo i get basic auth failed, you need access token.

i did setup access token, my access token has FULL access.

in old 1.9 source tree same token works flawless, but in new fugly 3.x nothing works. removing all account restarting git, doesn’t work. adding manually account to setting (which creates 2 entries, one for basic auth, and one account) doesn’t work. yes PAT refresh token says SUCCESS but PUSH to repository always fails.

guys can you finally fix this? 

it’s huge pain, and whenever i forget to decline upgrade to 3.x shit. i need to revert back to 1.9 to get working git client.

GitLab Forum

Loading

Unlike this post, I am on macOS.

I have the password configured in GitLab. I also have an SSL key created after the project was made on GitLab.

When I use an existing folder for a new project and follow the steps below, I am prompted to enter my GitLab username and password.

Existing folder

cd existing_folder
git init
git remote add origin https://gitlab.com/sobopla/Geronimod.git
git add .
git commit -m "Initial commit"
git push -u origin master

After the password is entered I get the following error.

remote: HTTP Basic: Access denied
fatal: Authentication failed for ‘https://gitlab.com/myname/myproject’

Troll's user avatar

Troll

1,8653 gold badges15 silver badges33 bronze badges

asked Dec 18, 2017 at 0:26

jeancode's user avatar

5

It happens every time I’m forced to change the Windows password and none of the above answers helped me.

Try the below solution which works for me:

  1. Go to Windows Credential Manager. This is done in an EN-US Windows by pressing the Windows Key and typing ‘credential’. In other
    localized Windows variants you need to use the localized term (See
    comments for some examples).

    alternatively you can use the shortcut
    control /name Microsoft.CredentialManager in the run dialog
    (WIN+R)

  2. Edit the git entry under Windows Credentials, replacing old
    password with the new one.

Troll's user avatar

Troll

1,8653 gold badges15 silver badges33 bronze badges

answered Aug 30, 2018 at 8:49

mpro's user avatar

mprompro

14.1k5 gold badges28 silver badges43 bronze badges

16

For me, the following worked:

Do not use your GitLab password, but create an access token and use it instead of your password:

  1. In GitLab, at the top-right corner, go to Personal Profile → Settings → Access Tokens
    Step 1

  2. Create a new personal access token (check the api option)
    Step 2

  3. git clone ...

  4. When you are asked for your password, copy and paste the access token instead of your GitLab password

    Step 3

Troll's user avatar

Troll

1,8653 gold badges15 silver badges33 bronze badges

answered Jul 2, 2018 at 10:07

JavAlex's user avatar

JavAlexJavAlex

4,7441 gold badge12 silver badges14 bronze badges

18

You can try the following command:

git config --system --unset credential.helper

Then, enter a new password for Git remote server.

Eric Bolinger's user avatar

answered May 30, 2018 at 5:41

hatanooh's user avatar

hatanoohhatanooh

3,8011 gold badge14 silver badges9 bronze badges

9

I got the same error and I solved this by :

  1. Apply command from cmd (run as administrator)

    git config --system --unset credential.helper

  2. And then I removed gitconfig file from C:Program FilesGitmingw64/etc/ location (Note: this path will be different in MAC like «/Users/username»)

  3. After that use git command like git pull or git push, it asked me for username and password. applying valid username and password and git command working.

hope this will help you…

Barry Michael Doyle's user avatar

answered Jun 26, 2018 at 11:56

Bharti Ladumor's user avatar

Bharti LadumorBharti Ladumor

1,5941 gold badge9 silver badges17 bronze badges

4

Go to Windows Credential Manager (press Windows Key and type ‘credential’) to edit the git entry under Windows Credentials. Replace old password with the new one.

Windows Credential Manager

JJJ's user avatar

JJJ

32.8k20 gold badges89 silver badges102 bronze badges

answered Nov 30, 2018 at 20:07

Andy Quiroz's user avatar

Andy QuirozAndy Quiroz

8357 silver badges8 bronze badges

2

Just add your username before the domain:

https://**username**@gitlab.com/user/projectgit

And the assistant will ask you the password

answered Jul 17, 2019 at 13:27

gal007's user avatar

gal007gal007

6,8418 gold badges47 silver badges67 bronze badges

1

I was also facing the same issue. The reason for the problem was authentication error.
To solve this problem go to
Control Panel -> Credential Manager -> Generic Credentials
here find your gitlab credential and edit them.
Make sure your ID password is right or not

enter image description here

barbsan's user avatar

barbsan

3,40811 gold badges21 silver badges28 bronze badges

answered Jun 3, 2019 at 9:43

Kshama Jain's user avatar

Kshama JainKshama Jain

4595 silver badges3 bronze badges

1

If you are using git > 2.11 and using Kerberos to interact with Gitlab you need set this configuration in your local git to avoid the remote: HTTP Basic: Access denied error.

$ git config --global http.emptyAuth true

Source

answered Jan 11, 2018 at 14:22

Pigueiras's user avatar

PigueirasPigueiras

18.7k10 gold badges64 silver badges87 bronze badges

4

Well, I faced the same issue whenever I change my login password.

Below is the command I need to run to fix this issue:-

git config --global credential.helper wincred

After running above command it asks me again my updated username and password.

halfer's user avatar

halfer

19.8k17 gold badges98 silver badges185 bronze badges

answered Jun 26, 2018 at 7:00

Vikash Pandey's user avatar

Vikash PandeyVikash Pandey

5,4116 gold badges40 silver badges42 bronze badges

0

Note: do not mix GitLab SSL settings and GitLab SSH keys.

If what you have configured in your GitLab profile is an SSH public key, then your HTTPS URL would not use it.

Regarding your HTTPS credentials, double-check:

  • if the two-factor authentication is disabled, or
  • if you have special characters in your username or password, or
  • if you have a Git credential helper: git config credential.helper.

answered Dec 18, 2017 at 6:02

VonC's user avatar

VonCVonC

1.2m518 gold badges4344 silver badges5161 bronze badges

13

Before digging into the solution lets first see why this happens.

Before any transaction with git that your machine does git checks for your authentication which can be done using

  1. An SSH key token present in your machine and shared with git-repo(most preferred)
    OR
  2. Using your username/password (mostly used)

Why did this happen

In simple words, this happened because the credentials stored in your machine are not authentic i.e.there are chances that your password stored in the machine has changed from whats there in git therefore

Solution

Head towards, control panel and search for Credential Manager look for your use git url and change the creds.

There you go this works with mostly every that windows keep track off

answered Oct 6, 2020 at 19:00

Manasvi Mittal's user avatar

1

It happens if you change your login or password of git service account (GitHub or GitLab, Bitbacket, etc). You need to change it in Windows Credentials Manager too.

So, type «Credential Manager» (rus. «Диспетчер Учетных Данных») in Windows Search menu and go to your git service account and change data too.

enter image description here

answered May 26, 2019 at 18:19

Dyno Cris's user avatar

Dyno CrisDyno Cris

1,7331 gold badge10 silver badges19 bronze badges

1

Open command prompt as administrator then run this command:

git config --system --unset credential.helper

answered Oct 12, 2018 at 5:27

MD. Shafayatul Haque's user avatar

3

Try this:

  1. Go to: C:/Users/(YourUserName)/
  2. Delete file .gitconfig

Stephen Rauch's user avatar

Stephen Rauch

47.4k31 gold badges105 silver badges134 bronze badges

answered Jun 25, 2018 at 3:29

boy_vkallstar's user avatar

1

There are two ways I got around this problem:

  1. I added my username to the front of the remote URL (https://username@gitRepoURL)

    • Not always the best solution; where I work, even though we’re slowly moving towards using GIT, we have our applications on a network drive, so if I do this, only I can push changes even if someone else worked on a feature.
  2. I can’t run git config --system --unset credential.helper from GIT Bash, so I had to open up an Admin Command Prompt and run it there (this assumes you installed GIT such that it can run from both GIT Bash and the Command Prompt). From Bash, I get a «could not lock config file» error.

answered Mar 11, 2019 at 18:52

Artorias2718's user avatar

1

It is certainly a bug, ssh works with one of my machines but not the other. I solved it, follow these.

  1. Generate an access token with never expire date, and select all the options available.
  2. Remove the existing SSH keys.
  3. Clone the repo with the https instead of ssh.
  4. Use the username but use the generated access token instead of password.

enter image description here

alternatively you can set remote to http by using this command in the existing repo, and use this command git remote set-url origin https://gitlab.com/[username]/[repo-name].git

answered Sep 22, 2020 at 15:44

Sitecore Sam's user avatar

Sitecore SamSitecore Sam

3772 gold badges8 silver badges14 bronze badges

1

Go to Control Panel->Credential Manager->Windows Credentials select github or gitlab credentials and modify it. This is for windows10

answered Oct 10, 2018 at 14:04

SanjX's user avatar

SanjXSanjX

9271 gold badge8 silver badges12 bronze badges

0

When I had the same problem,

I solved it by removing the file «passwd» in

C:Users<USERNAME>AppDataLocalAtlassianSourceTree

After removing Sourcetree will prompt for the password.

Note:
OS Version : win10 
Sourcetree Version:  3.1

SAMUEL's user avatar

SAMUEL

7,9883 gold badges42 silver badges42 bronze badges

answered Jun 6, 2019 at 8:45

Jean-Philippe Vankemmel's user avatar

2

i removed gitlab credential from ‘Credential Manager’ in windows and pushed successfully

answered Aug 26, 2018 at 6:22

saiedkia's user avatar

saiedkiasaiedkia

691 silver badge4 bronze badges

For Mac user:

  1. Go to keychain and delete gitlab accounts
  2. Go to your project path in terminal and simply type git pull
  3. Then you will be asked for username and password for gitlab
  4. Enter your username which you will find out in gitlab account in profile section.
  5. Then after that enter you updated password here.
  6. Here we go, again try to push your code, it may help you guys.

answered Jun 3, 2019 at 10:48

vikash kumar's user avatar

For me it was some other git URL placed in config file, so I did change it manually:

  1. Move to .git/config file and edit it,
  2. Remove invalid URL(if it’s there) and paste the valid git SSH/HTTP URL like below way:
[remote "origin"]
        url = git@gitlab.com:prat3ik/my-project.git

And it was working!!

answered Oct 5, 2019 at 10:15

Pratik Patel's user avatar

Pratik PatelPratik Patel

2,1693 gold badges23 silver badges30 bronze badges

0

I had the same problem using GitLab, and here’s how i fixed it:

  1. Generate an access token: to do so go to settings/access tokens, then give it a name and expiration date and submit.

  2. In your project files open the «config» file in «.git» directory: /.git/config.

  3. You will find a line like this:

    [remote «origin»]
    url = https://[username]:[token]@your-domain.com/your-project.git

  4. You will have your gitlab username instead of [username], and you should replace [token] with your token generated in step 1.

  5. Save the changes.

answered Nov 26, 2019 at 10:41

Badr's user avatar

BadrBadr

1774 silver badges16 bronze badges

Strangely enough, what worked for me was to sign out and sign back in to the GitLab web UI.

I have no earthly idea why this worked.

answered Jul 27, 2020 at 18:26

ATOMP's user avatar

ATOMPATOMP

1,27110 silver badges29 bronze badges

0

So for me the problem was that I had created my GitLab account via linking my GitHub account to it. This meant that no password formally existed for the account as it was created via hotlink between GitHub and GitLab. I fixed it by going to GitLab Settings -> Password -> and writing the same password as my GitHub account had.

answered Nov 22, 2018 at 21:04

Momchill's user avatar

MomchillMomchill

4176 silver badges15 bronze badges

None of the above solutions worked for me and I don’t have admin rights on my laptop, but they eventually led me to the git tools credential storage doc :

My setup
Windows 10 |
git version 2.18.0.windows.1 |
Clone through HTTPS link

This solution works if you use wincred as credential helper :

> git config --global credential.helper
wincred

Changing the helper to «cache» should do the trick, as it will ask you to provide your credentials again. To set it to cache, just type :

> git config --global credential.helper cache

Check your update is active:

> git config --global credential.helper
cache

You should now be able to clone / pull / fetch as before.

answered Dec 18, 2018 at 10:37

lkostka's user avatar

lkostkalkostka

7115 silver badges10 bronze badges

In my case I reinstalled to the latest version of git (currently 2.16.2). I don’t know if it was that my old version of git was outdated, but I read on a github page that this should be done if you stumble into https cloning errors. I figured it was an https cloning error as the error focuses on HTTP Basic, while GitLab uses HTTPS. I might be wrong in this thought process, but the solution helped in my case, and I hope this helps anyone in the future!

answered Mar 10, 2018 at 18:11

Andreas Forslöw's user avatar

Unlike this post, I am on macOS.

I have the password configured in GitLab. I also have an SSL key created after the project was made on GitLab.

When I use an existing folder for a new project and follow the steps below, I am prompted to enter my GitLab username and password.

Existing folder

cd existing_folder
git init
git remote add origin https://gitlab.com/sobopla/Geronimod.git
git add .
git commit -m "Initial commit"
git push -u origin master

After the password is entered I get the following error.

remote: HTTP Basic: Access denied
fatal: Authentication failed for ‘https://gitlab.com/myname/myproject’

Troll's user avatar

Troll

1,8693 gold badges15 silver badges33 bronze badges

asked Dec 18, 2017 at 0:26

jeancode's user avatar

5

It happens every time I’m forced to change the Windows password and none of the above answers helped me.

Try the below solution which works for me:

  1. Go to Windows Credential Manager. This is done in an EN-US Windows by pressing the Windows Key and typing ‘credential’. In other
    localized Windows variants you need to use the localized term (See
    comments for some examples).

    alternatively you can use the shortcut
    control /name Microsoft.CredentialManager in the run dialog
    (WIN+R)

  2. Edit the git entry under Windows Credentials, replacing old
    password with the new one.

Troll's user avatar

Troll

1,8693 gold badges15 silver badges33 bronze badges

answered Aug 30, 2018 at 8:49

mpro's user avatar

mprompro

13.7k5 gold badges27 silver badges41 bronze badges

16

For me, the following worked:

Do not use your GitLab password, but create an access token and use it instead of your password:

  1. In GitLab, at the top-right corner, go to Personal Profile → Settings → Access Tokens
    Step 1

  2. Create a new personal access token (check the api option)
    Step 2

  3. git clone ...

  4. When you are asked for your password, copy and paste the access token instead of your GitLab password

    Step 3

Troll's user avatar

Troll

1,8693 gold badges15 silver badges33 bronze badges

answered Jul 2, 2018 at 10:07

JavAlex's user avatar

JavAlexJavAlex

4,4541 gold badge12 silver badges14 bronze badges

17

You can try the following command:

git config --system --unset credential.helper

Then, enter a new password for Git remote server.

Eric Bolinger's user avatar

answered May 30, 2018 at 5:41

hatanooh's user avatar

hatanoohhatanooh

3,5411 gold badge14 silver badges9 bronze badges

8

I got the same error and I solved this by :

  1. Apply command from cmd (run as administrator)

    git config --system --unset credential.helper

  2. And then I removed gitconfig file from C:Program FilesGitmingw64/etc/ location (Note: this path will be different in MAC like «/Users/username»)

  3. After that use git command like git pull or git push, it asked me for username and password. applying valid username and password and git command working.

hope this will help you…

Barry Michael Doyle's user avatar

answered Jun 26, 2018 at 11:56

Bharti Ladumor's user avatar

Bharti LadumorBharti Ladumor

1,5941 gold badge9 silver badges17 bronze badges

4

Go to Windows Credential Manager (press Windows Key and type ‘credential’) to edit the git entry under Windows Credentials. Replace old password with the new one.

Windows Credential Manager

JJJ's user avatar

JJJ

32.6k20 gold badges89 silver badges102 bronze badges

answered Nov 30, 2018 at 20:07

Andy Quiroz's user avatar

Andy QuirozAndy Quiroz

8357 silver badges8 bronze badges

3

Just add your username before the domain:

https://**username**@gitlab.com/user/projectgit

And the assistant will ask you the password

answered Jul 17, 2019 at 13:27

gal007's user avatar

gal007gal007

6,7317 gold badges46 silver badges66 bronze badges

2

I was also facing the same issue. The reason for the problem was authentication error.
To solve this problem go to
Control Panel -> Credential Manager -> Generic Credentials
here find your gitlab credential and edit them.
Make sure your ID password is right or not

enter image description here

barbsan's user avatar

barbsan

3,36811 gold badges21 silver badges28 bronze badges

answered Jun 3, 2019 at 9:43

Kshama Jain's user avatar

Kshama JainKshama Jain

4595 silver badges3 bronze badges

1

If you are using git > 2.11 and using Kerberos to interact with Gitlab you need set this configuration in your local git to avoid the remote: HTTP Basic: Access denied error.

$ git config --global http.emptyAuth true

Source

answered Jan 11, 2018 at 14:22

Pigueiras's user avatar

PigueirasPigueiras

18.5k10 gold badges65 silver badges86 bronze badges

4

Well, I faced the same issue whenever I change my login password.

Below is the command I need to run to fix this issue:-

git config --global credential.helper wincred

After running above command it asks me again my updated username and password.

halfer's user avatar

halfer

19.7k17 gold badges94 silver badges182 bronze badges

answered Jun 26, 2018 at 7:00

Vikash Pandey's user avatar

Vikash PandeyVikash Pandey

5,3336 gold badges40 silver badges42 bronze badges

1

Note: do not mix GitLab SSL settings and GitLab SSH keys.

If what you have configured in your GitLab profile is an SSH public key, then your HTTPS URL would not use it.

Regarding your HTTPS credentials, double-check:

  • if the two-factor authentication is disabled, or
  • if you have special characters in your username or password, or
  • if you have a Git credential helper: git config credential.helper.

answered Dec 18, 2017 at 6:02

VonC's user avatar

VonCVonC

1.2m506 gold badges4243 silver badges5061 bronze badges

13

Before digging into the solution lets first see why this happens.

Before any transaction with git that your machine does git checks for your authentication which can be done using

  1. An SSH key token present in your machine and shared with git-repo(most preferred)
    OR
  2. Using your username/password (mostly used)

Why did this happen

In simple words, this happened because the credentials stored in your machine are not authentic i.e.there are chances that your password stored in the machine has changed from whats there in git therefore

Solution

Head towards, control panel and search for Credential Manager look for your use git url and change the creds.

There you go this works with mostly every that windows keep track off

answered Oct 6, 2020 at 19:00

Manasvi Mittal's user avatar

1

It happens if you change your login or password of git service account (GitHub or GitLab, Bitbacket, etc). You need to change it in Windows Credentials Manager too.

So, type «Credential Manager» (rus. «Диспетчер Учетных Данных») in Windows Search menu and go to your git service account and change data too.

enter image description here

answered May 26, 2019 at 18:19

Dyno Cris's user avatar

Dyno CrisDyno Cris

1,57510 silver badges17 bronze badges

1

Open command prompt as administrator then run this command:

git config --system --unset credential.helper

answered Oct 12, 2018 at 5:27

MD. Shafayatul Haque's user avatar

3

Try this:

  1. Go to: C:/Users/(YourUserName)/
  2. Delete file .gitconfig

Stephen Rauch's user avatar

Stephen Rauch

46.6k31 gold badges109 silver badges131 bronze badges

answered Jun 25, 2018 at 3:29

boy_vkallstar's user avatar

1

There are two ways I got around this problem:

  1. I added my username to the front of the remote URL (https://username@gitRepoURL)

    • Not always the best solution; where I work, even though we’re slowly moving towards using GIT, we have our applications on a network drive, so if I do this, only I can push changes even if someone else worked on a feature.
  2. I can’t run git config --system --unset credential.helper from GIT Bash, so I had to open up an Admin Command Prompt and run it there (this assumes you installed GIT such that it can run from both GIT Bash and the Command Prompt). From Bash, I get a «could not lock config file» error.

answered Mar 11, 2019 at 18:52

Artorias2718's user avatar

1

It is certainly a bug, ssh works with one of my machines but not the other. I solved it, follow these.

  1. Generate an access token with never expire date, and select all the options available.
  2. Remove the existing SSH keys.
  3. Clone the repo with the https instead of ssh.
  4. Use the username but use the generated access token instead of password.

enter image description here

alternatively you can set remote to http by using this command in the existing repo, and use this command git remote set-url origin https://gitlab.com/[username]/[repo-name].git

answered Sep 22, 2020 at 15:44

Sitecore Sam's user avatar

Sitecore SamSitecore Sam

3772 gold badges8 silver badges14 bronze badges

1

Go to Control Panel->Credential Manager->Windows Credentials select github or gitlab credentials and modify it. This is for windows10

answered Oct 10, 2018 at 14:04

SanjX's user avatar

SanjXSanjX

8571 gold badge8 silver badges11 bronze badges

0

i removed gitlab credential from ‘Credential Manager’ in windows and pushed successfully

answered Aug 26, 2018 at 6:22

saiedkia's user avatar

saiedkiasaiedkia

691 silver badge4 bronze badges

When I had the same problem,

I solved it by removing the file «passwd» in

C:Users<USERNAME>AppDataLocalAtlassianSourceTree

After removing Sourcetree will prompt for the password.

Note:
OS Version : win10 
Sourcetree Version:  3.1

SAMUEL's user avatar

SAMUEL

7,8202 gold badges43 silver badges41 bronze badges

answered Jun 6, 2019 at 8:45

Jean-Philippe Vankemmel's user avatar

2

For Mac user:

  1. Go to keychain and delete gitlab accounts
  2. Go to your project path in terminal and simply type git pull
  3. Then you will be asked for username and password for gitlab
  4. Enter your username which you will find out in gitlab account in profile section.
  5. Then after that enter you updated password here.
  6. Here we go, again try to push your code, it may help you guys.

answered Jun 3, 2019 at 10:48

vikash kumar's user avatar

For me it was some other git URL placed in config file, so I did change it manually:

  1. Move to .git/config file and edit it,
  2. Remove invalid URL(if it’s there) and paste the valid git SSH/HTTP URL like below way:
[remote "origin"]
        url = git@gitlab.com:prat3ik/my-project.git

And it was working!!

answered Oct 5, 2019 at 10:15

Pratik Patel's user avatar

Pratik PatelPratik Patel

2,0993 gold badges22 silver badges29 bronze badges

0

I had the same problem using GitLab, and here’s how i fixed it:

  1. Generate an access token: to do so go to settings/access tokens, then give it a name and expiration date and submit.

  2. In your project files open the «config» file in «.git» directory: /.git/config.

  3. You will find a line like this:

    [remote «origin»]
    url = https://[username]:[token]@your-domain.com/your-project.git

  4. You will have your gitlab username instead of [username], and you should replace [token] with your token generated in step 1.

  5. Save the changes.

answered Nov 26, 2019 at 10:41

Badr's user avatar

BadrBadr

1776 silver badges15 bronze badges

Strangely enough, what worked for me was to sign out and sign back in to the GitLab web UI.

I have no earthly idea why this worked.

answered Jul 27, 2020 at 18:26

ATOMP's user avatar

ATOMPATOMP

1,24110 silver badges27 bronze badges

0

None of the above solutions worked for me and I don’t have admin rights on my laptop, but they eventually led me to the git tools credential storage doc :

My setup
Windows 10 |
git version 2.18.0.windows.1 |
Clone through HTTPS link

This solution works if you use wincred as credential helper :

> git config --global credential.helper
wincred

Changing the helper to «cache» should do the trick, as it will ask you to provide your credentials again. To set it to cache, just type :

> git config --global credential.helper cache

Check your update is active:

> git config --global credential.helper cache

You should now be able to clone / pull / fetch as before.

answered Dec 18, 2018 at 10:37

lkostka's user avatar

lkostkalkostka

6915 silver badges10 bronze badges

In my case I reinstalled to the latest version of git (currently 2.16.2). I don’t know if it was that my old version of git was outdated, but I read on a github page that this should be done if you stumble into https cloning errors. I figured it was an https cloning error as the error focuses on HTTP Basic, while GitLab uses HTTPS. I might be wrong in this thought process, but the solution helped in my case, and I hope this helps anyone in the future!

answered Mar 10, 2018 at 18:11

Andreas Forslöw's user avatar

If your trying to login Gitlab with your existing Git account.
You need to reset your password of Gitlab, for the first time.

  1. Step: Navigate to setting by clicking your profile icon( drop down menu on top right corner).
  2. Step: Go to settings
  3. Step: Click on the lock icon or glyphicon icon(i.e password).
  4. Step : Enter the new password for Gitlab.

answered Jun 11, 2018 at 10:31

Gani's user avatar

GaniGani

3841 gold badge4 silver badges16 bronze badges

{lang: ‘ru’}

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

Permission denied (publickey)

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

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

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

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

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

Im trying to push to github with sourcetree but get the following error:

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v
—tags origin live_version:live_version remote: Invalid username or password. fatal: Authentication failed for
‘https://github.com/myname/myrepo/’ Pushing to
https://github.com/myname/myrepo

Completed with errors, see above.

enter image description here
However when I go to

tools > authentication > my github account

And click edit > refresh oauth token
enter image description here
A page opens and I get:

Authentication Successful

SourceTree has been successfully authenticated. You may now close this page.

It always worked but it suddenly stopped, i do not have two factor authentication.
I tried deleting the account and adding it again to no avail.
How can I get the connection working again so that I can push my project to github.

Sourcetree version 2.1.8.0

asked Aug 10, 2017 at 20:30

Sven van den Boogaart's user avatar

1

I found the answer here, it is a known bug for version 2.1.8+

The following steps fixed it for me:

Tools > Options > Git > Update Embedded Git

Also pushing with the command line works.

EDIT

Also adding @Latisha’s answer:

1. Do the above.
2. Close Sourcetree
3. Delete AppDataLocalAtlassianSourceTreepasswd 
4. Restart SourceTree

answered Aug 11, 2017 at 14:09

Sven van den Boogaart's user avatar

15

I struggled with this a lot, what solved it for me on my Mac is:

  • Open finder, click Cmd + Shift + g
  • enter ~/Library/
  • Go to Application Support/SourceTree folder
  • delete userName@STAuth-bitbucket.org
  • Open KeyChain Access
  • search for sourctree
  • delete the ‘login’ item
  • clone your source from bitbucket
  • KeyChain will ask for you bitbucket pass

Maxim Kholyavkin's user avatar

answered Nov 19, 2017 at 16:15

Alon Rosenfeld's user avatar

11

I faced this issue when i updated Embedded Git. Solved it by removing passwd file. you can find it here. then restart source tree.

AppDataLocalAtlassianSourceTreepasswd

answered Oct 16, 2018 at 9:36

Mohamed Nageh's user avatar

Mohamed NagehMohamed Nageh

1,9151 gold badge18 silver badges27 bronze badges

1

For OSX following by steps below

Go to: Preferences -> Advance -> Choose the account in table you want to remove -> Click to remove enter image description here

answered May 14, 2020 at 16:55

Duy Phan's user avatar

Duy PhanDuy Phan

7736 silver badges5 bronze badges

I had the same problem for Sourcetree 2.10, but with the above solution not working.

Reverting to version 2.0 solved it.

Sourcetree download archive: (https://www.sourcetreeapp.com/download-archives)

answered Aug 15, 2017 at 7:17

Rasmus's user avatar

RasmusRasmus

2215 silver badges6 bronze badges

3

I just solved this problem by using an access token. I use macbook, all answers above didn’t work for me. Go to your github account, click your profile image on right top corner, then click:

Settings -> Developer settings -> Personal access tokens -> Generate new token

Paste this token into sourcetree popup window, required password area, instead of typing your account password. Github uses two step verification, so you need to use a token rather than account password. Good luck! Let me know if this works for you.

answered Feb 26, 2019 at 11:19

Mike's user avatar

MikeMike

7991 gold badge7 silver badges15 bronze badges

This worked for me on Mac

  1. Goto Preferences -> Git
  2. Use System Git

answered Jan 10, 2021 at 19:32

Tushar Vengurlekar's user avatar

I had the same problem , I Relogged In to the account solved this error for me.

answered Jan 23, 2018 at 6:20

Abhishek's user avatar

AbhishekAbhishek

1,6542 gold badges18 silver badges29 bronze badges

1

  1. Delete your saved account in toolsoption dialog.
  2. Push or pull again, and SourceTree will ask you to input your login name and password.

answered Jun 28, 2019 at 3:28

beibeitu's user avatar

If you do have two-factor authentication enabled in GitHub you might have gotten here as well. In that case follow AlonR’s answer (for Mac — worked for me) or Sven’s answer (for Windows — untested) and then follow the instructions here to make it work.

  • Currently the GitHub token page is here.

answered Feb 17, 2019 at 17:23

MikeL's user avatar

MikeLMikeL

2,6562 gold badges21 silver badges40 bronze badges

I had the same problem and I fixed it by installing the latest version of git for windows

answered Apr 17, 2018 at 7:56

emanuel.virca's user avatar

For SourceTree 2.7.6 for macOS using embedded git I followed all the suggested answers but still had the same problem.

The solution for me was to turn off two factor authentication.

Obviously not ideal, but sometimes you just need to get your work done.

answered Jun 27, 2018 at 8:26

lewis's user avatar

lewislewis

2,8252 gold badges36 silver badges68 bronze badges

1

On Windows try:

  1. Tools> Options> Authentication — delete from Git Saved Password your problem repo data (ex login@repo.com)
  2. Select tab with problem repo.
  3. Open terminal and make some git command (ex git pull origin) and you will be asked login and password. Input correct login and password. Login and password will be updated and all works again.

answered Jul 10, 2018 at 9:17

0xA0's user avatar

0xA00xA0

6095 silver badges6 bronze badges

I typed the wrong username (email address) when pushing and what worked for me was:

Open KeyChain Access
search for SourcTree
delete the ‘login’ item

Then go to Sourcetree > Preferences > Advanced and delete the default usernames that includes the wrong email address.

answered May 16, 2019 at 13:17

user909943's user avatar

In my case, this happened on one of my two computers after I switched to OAuth on GitHub. The error message was referring to git-credential-manager.exe, which is located in AppDataLocalAtlassianSourceTreegit_extras. I noticed that the version on my working machine is from 2018, whereas the one on the non-working machine is from 2017. Both run the newest version of SourceTree (3.0.17). This is what I did to get it to work:

  1. Uninstall SourceTree
  2. Since this did not remove AppDataLocalAtlassianSourceTree, I deleted that entire directory manually
  3. Updated git to the newest version (neat: >git update-git-for-windows) — probably not necessary but a good idea anyway
  4. Re-installed SourceTree
  5. Added existing local repos
  6. Fetch — and finally, after entering username and password (twice, if memory serves), I get asked for the OAuth token. Yipee!

Surprisingly, AppDataLocalAtlassianSourceTreegit_extras was created, but is now empty…

answered Apr 12, 2020 at 12:37

JoergEwald's user avatar

JoergEwaldJoergEwald

3693 silver badges10 bronze badges

Sourcetree saves username in the below file. Change your username in this file and restart your sourcetree App

C:Users{USER}AppDataLocalAtlassianSourceTreeuserhosts

Or Use your username in Clone URL. This will make sourcetree to request password for the new User

https://{user}@bitbucket.org

answered May 18, 2021 at 12:42

robinrjoe's user avatar

robinrjoerobinrjoe

1991 silver badge12 bronze badges

My setup

  • Windows 10
  • Sourcetree 3.4.5

What worked for me was a combination of some of the existing answers

  • Use system Git in Tools > Preferences.
  • Remove existing account credentials in Tools > Preferences.
  • Restart Sourcetree.
  • Do a complete credential check from command-line git with git push/pull, enter full credential once, and then go back to Sourcetree to retry.

answered Jun 17, 2021 at 4:07

kakyo's user avatar

kakyokakyo

9,75614 gold badges70 silver badges131 bronze badges

It may be a simple case of expired Personal Access Token.

answered Nov 19, 2021 at 15:34

Muhammad Irfan's user avatar

For Mac user s:

Go to Preferences ▶︎ Advanced menu and delete the hostname that you want to reset.

After this, you can re-enter your username and password whenever needed

answered Jan 24, 2022 at 17:11

Ash's user avatar

AshAsh

5,3651 gold badge39 silver badges34 bronze badges

I have the same error in Sourcetree app and after some changes (update git and Sourcetree app to latest version and delete AppDataLocalAtlassianSourceTreepasswd) see this message when I want login.

remote: Bitbucket Cloud recently stopped supporting account passwords for Git authentication.

Good luck! Let me know if this works for you.

remote: See our community post for more details: https://atlassian.community/t5/x/x/ba-p/1948231

remote: App passwords are recommended for most use cases and can be created in your Personal settings:

remote: https://bitbucket.org/account/settings/app-passwords/

Create an app password

To create an app password:

  1. From your avatar in the bottom left, click Personal Settings.

  2. Click App passwords under Access management.

  3. Click Create app password.

  4. Give the app password a name related to the application that will
    use the password.

  5. Select the specific access and permissions you want this application
    password to have.

  6. Copy the generated password and either record or paste it into the
    application you want to give access. The password is only displayed
    this one time.

Add an app password to Sourcetree or another application

To add your app password to Sourcetree:

  1. Go to the tab where you’ll add or edit your account details:

    • (Windows) Go to Tools > Options. From the Options dialog, select the
      Authentication tab.

    • (macOS) Go to Sourcetree > Preferences. From the dialog that
      options, select the Accounts tab.

  2. Click to Edit your account details or Add a new one.

  3. From Authentication or Auth Type, select Basic and enter your
    Username if it’s not already there.

  4. Enter the app password you just created as your Password. If you’re
    on Windows, you’ll need to hit Refresh Password first.

  5. Click OK or Save to save your account details.

To add your app password to another application, see the application’s documentation for how to apply the app password.

answered Mar 16, 2022 at 15:57

saeid mohammad hashem's user avatar

It was working for me in the Mac Terminal but not SourceTree 4.2.0. I changed my repository remote in SourceTree to include the path with the .git extension instead of the /src/master path and that worked for me. (To get the path, click on the clone button on the web page.)

answered Oct 11, 2022 at 21:13

avance's user avatar

avanceavance

1,9912 gold badges21 silver badges23 bronze badges

Im trying to push to github with sourcetree but get the following error:

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v
—tags origin live_version:live_version remote: Invalid username or password. fatal: Authentication failed for
‘https://github.com/myname/myrepo/’ Pushing to
https://github.com/myname/myrepo

Completed with errors, see above.

enter image description here
However when I go to

tools > authentication > my github account

And click edit > refresh oauth token
enter image description here
A page opens and I get:

Authentication Successful

SourceTree has been successfully authenticated. You may now close this page.

It always worked but it suddenly stopped, i do not have two factor authentication.
I tried deleting the account and adding it again to no avail.
How can I get the connection working again so that I can push my project to github.

Sourcetree version 2.1.8.0

asked Aug 10, 2017 at 20:30

Sven van den Boogaart's user avatar

1

I found the answer here, it is a known bug for version 2.1.8+

The following steps fixed it for me:

Tools > Options > Git > Update Embedded Git

Also pushing with the command line works.

EDIT

Also adding @Latisha’s answer:

1. Do the above.
2. Close Sourcetree
3. Delete AppDataLocalAtlassianSourceTreepasswd 
4. Restart SourceTree

answered Aug 11, 2017 at 14:09

Sven van den Boogaart's user avatar

15

I struggled with this a lot, what solved it for me on my Mac is:

  • Open finder, click Cmd + Shift + g
  • enter ~/Library/
  • Go to Application Support/SourceTree folder
  • delete userName@STAuth-bitbucket.org
  • Open KeyChain Access
  • search for sourctree
  • delete the ‘login’ item
  • clone your source from bitbucket
  • KeyChain will ask for you bitbucket pass

Maxim Kholyavkin's user avatar

answered Nov 19, 2017 at 16:15

Alon Rosenfeld's user avatar

11

I faced this issue when i updated Embedded Git. Solved it by removing passwd file. you can find it here. then restart source tree.

AppDataLocalAtlassianSourceTreepasswd

answered Oct 16, 2018 at 9:36

Mohamed Nageh's user avatar

Mohamed NagehMohamed Nageh

1,9151 gold badge18 silver badges27 bronze badges

1

For OSX following by steps below

Go to: Preferences -> Advance -> Choose the account in table you want to remove -> Click to remove enter image description here

answered May 14, 2020 at 16:55

Duy Phan's user avatar

Duy PhanDuy Phan

7736 silver badges5 bronze badges

I had the same problem for Sourcetree 2.10, but with the above solution not working.

Reverting to version 2.0 solved it.

Sourcetree download archive: (https://www.sourcetreeapp.com/download-archives)

answered Aug 15, 2017 at 7:17

Rasmus's user avatar

RasmusRasmus

2215 silver badges6 bronze badges

3

I just solved this problem by using an access token. I use macbook, all answers above didn’t work for me. Go to your github account, click your profile image on right top corner, then click:

Settings -> Developer settings -> Personal access tokens -> Generate new token

Paste this token into sourcetree popup window, required password area, instead of typing your account password. Github uses two step verification, so you need to use a token rather than account password. Good luck! Let me know if this works for you.

answered Feb 26, 2019 at 11:19

Mike's user avatar

MikeMike

7991 gold badge7 silver badges15 bronze badges

This worked for me on Mac

  1. Goto Preferences -> Git
  2. Use System Git

answered Jan 10, 2021 at 19:32

Tushar Vengurlekar's user avatar

I had the same problem , I Relogged In to the account solved this error for me.

answered Jan 23, 2018 at 6:20

Abhishek's user avatar

AbhishekAbhishek

1,6542 gold badges18 silver badges29 bronze badges

1

  1. Delete your saved account in toolsoption dialog.
  2. Push or pull again, and SourceTree will ask you to input your login name and password.

answered Jun 28, 2019 at 3:28

beibeitu's user avatar

If you do have two-factor authentication enabled in GitHub you might have gotten here as well. In that case follow AlonR’s answer (for Mac — worked for me) or Sven’s answer (for Windows — untested) and then follow the instructions here to make it work.

  • Currently the GitHub token page is here.

answered Feb 17, 2019 at 17:23

MikeL's user avatar

MikeLMikeL

2,6562 gold badges21 silver badges40 bronze badges

I had the same problem and I fixed it by installing the latest version of git for windows

answered Apr 17, 2018 at 7:56

emanuel.virca's user avatar

For SourceTree 2.7.6 for macOS using embedded git I followed all the suggested answers but still had the same problem.

The solution for me was to turn off two factor authentication.

Obviously not ideal, but sometimes you just need to get your work done.

answered Jun 27, 2018 at 8:26

lewis's user avatar

lewislewis

2,8252 gold badges36 silver badges68 bronze badges

1

On Windows try:

  1. Tools> Options> Authentication — delete from Git Saved Password your problem repo data (ex login@repo.com)
  2. Select tab with problem repo.
  3. Open terminal and make some git command (ex git pull origin) and you will be asked login and password. Input correct login and password. Login and password will be updated and all works again.

answered Jul 10, 2018 at 9:17

0xA0's user avatar

0xA00xA0

6095 silver badges6 bronze badges

I typed the wrong username (email address) when pushing and what worked for me was:

Open KeyChain Access
search for SourcTree
delete the ‘login’ item

Then go to Sourcetree > Preferences > Advanced and delete the default usernames that includes the wrong email address.

answered May 16, 2019 at 13:17

user909943's user avatar

In my case, this happened on one of my two computers after I switched to OAuth on GitHub. The error message was referring to git-credential-manager.exe, which is located in AppDataLocalAtlassianSourceTreegit_extras. I noticed that the version on my working machine is from 2018, whereas the one on the non-working machine is from 2017. Both run the newest version of SourceTree (3.0.17). This is what I did to get it to work:

  1. Uninstall SourceTree
  2. Since this did not remove AppDataLocalAtlassianSourceTree, I deleted that entire directory manually
  3. Updated git to the newest version (neat: >git update-git-for-windows) — probably not necessary but a good idea anyway
  4. Re-installed SourceTree
  5. Added existing local repos
  6. Fetch — and finally, after entering username and password (twice, if memory serves), I get asked for the OAuth token. Yipee!

Surprisingly, AppDataLocalAtlassianSourceTreegit_extras was created, but is now empty…

answered Apr 12, 2020 at 12:37

JoergEwald's user avatar

JoergEwaldJoergEwald

3693 silver badges10 bronze badges

Sourcetree saves username in the below file. Change your username in this file and restart your sourcetree App

C:Users{USER}AppDataLocalAtlassianSourceTreeuserhosts

Or Use your username in Clone URL. This will make sourcetree to request password for the new User

https://{user}@bitbucket.org

answered May 18, 2021 at 12:42

robinrjoe's user avatar

robinrjoerobinrjoe

1991 silver badge12 bronze badges

My setup

  • Windows 10
  • Sourcetree 3.4.5

What worked for me was a combination of some of the existing answers

  • Use system Git in Tools > Preferences.
  • Remove existing account credentials in Tools > Preferences.
  • Restart Sourcetree.
  • Do a complete credential check from command-line git with git push/pull, enter full credential once, and then go back to Sourcetree to retry.

answered Jun 17, 2021 at 4:07

kakyo's user avatar

kakyokakyo

9,75614 gold badges70 silver badges131 bronze badges

It may be a simple case of expired Personal Access Token.

answered Nov 19, 2021 at 15:34

Muhammad Irfan's user avatar

For Mac user s:

Go to Preferences ▶︎ Advanced menu and delete the hostname that you want to reset.

After this, you can re-enter your username and password whenever needed

answered Jan 24, 2022 at 17:11

Ash's user avatar

AshAsh

5,3651 gold badge39 silver badges34 bronze badges

I have the same error in Sourcetree app and after some changes (update git and Sourcetree app to latest version and delete AppDataLocalAtlassianSourceTreepasswd) see this message when I want login.

remote: Bitbucket Cloud recently stopped supporting account passwords for Git authentication.

Good luck! Let me know if this works for you.

remote: See our community post for more details: https://atlassian.community/t5/x/x/ba-p/1948231

remote: App passwords are recommended for most use cases and can be created in your Personal settings:

remote: https://bitbucket.org/account/settings/app-passwords/

Create an app password

To create an app password:

  1. From your avatar in the bottom left, click Personal Settings.

  2. Click App passwords under Access management.

  3. Click Create app password.

  4. Give the app password a name related to the application that will
    use the password.

  5. Select the specific access and permissions you want this application
    password to have.

  6. Copy the generated password and either record or paste it into the
    application you want to give access. The password is only displayed
    this one time.

Add an app password to Sourcetree or another application

To add your app password to Sourcetree:

  1. Go to the tab where you’ll add or edit your account details:

    • (Windows) Go to Tools > Options. From the Options dialog, select the
      Authentication tab.

    • (macOS) Go to Sourcetree > Preferences. From the dialog that
      options, select the Accounts tab.

  2. Click to Edit your account details or Add a new one.

  3. From Authentication or Auth Type, select Basic and enter your
    Username if it’s not already there.

  4. Enter the app password you just created as your Password. If you’re
    on Windows, you’ll need to hit Refresh Password first.

  5. Click OK or Save to save your account details.

To add your app password to another application, see the application’s documentation for how to apply the app password.

answered Mar 16, 2022 at 15:57

saeid mohammad hashem's user avatar

It was working for me in the Mac Terminal but not SourceTree 4.2.0. I changed my repository remote in SourceTree to include the path with the .git extension instead of the /src/master path and that worked for me. (To get the path, click on the clone button on the web page.)

answered Oct 11, 2022 at 21:13

avance's user avatar

avanceavance

1,9912 gold badges21 silver badges23 bronze badges

Итак, на днях зашли на учетную запись GitLab для хранения и отслеживания всех настроек.

Мы создали новый репозиторий в веб-интерфейсе GitLab и начали загружать каталог, который был в нашей персональной системе.

Все было хорошо, пока мы не попытались отправить код в удаленный репозиторий на GitHub. Это дало нам фатальную ошибку: “Authentical failed for xyz repository”.

Вот как выглядела ошибка:

destroyer@andreyex:~/Documents/Local-Code$ git push -u origin master
Username for 'https://gitlab.com': gitlab_profile_username
gitlab_profile_username@gitlab.com': 
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'https://gitlab.com/gitlab_account_username/gitlab_repository/'

Если вы столкнулись с подобной проблемой, позвольте мне показать вам, как исправить эту ошибку.

Обработка “удаленного: HTTP Basic: доступ запрещен” Ошибка с GitLab

Основная строка, которая дает некоторое представление о первопричине этой ошибки:

remote: HTTP Basic: Access denied

Почему мы это говорим? Потому что ваш репозиторий GitLab использует HTTPS. Ожидается, что между вашей системой и вашим хранилищем будет защищенное соединение.

Теперь, не должно ли это быть автоматически, используя HTTPS? Нет! Уже нет.

GitLab изменил свою политику, и теперь он ожидает, что вы будете использовать свой собственный ключ SSH для аутентификации в своем хранилище GitLab.

Другими словами, чтобы отправить код из локальной системы в удаленный репозиторий GitLab, вы должны создать пару ключей SSH и добавить открытый ключ в свой профиль GitLab .

Мы используем Linux, поэтому лучше всего выполнить шаги в Linux. Если вы используете Windows или macOS, вы должны найти как сделать то же самое в вашей операционной системе.

Сначала проверьте, если у вас уже есть ключи SSH:

ls ~/.ssh/id_rsa.pub

Если у вас его нет, создайте его, используя следующий раздел, иначе перейдите к разделу после этого.

Создание ключей SSH (если у вас его еще нет)

Мы используем Ubuntu, поэтому шаги для Ubuntu. Если вы используете другие дистрибутивы, шаги могут отличаться или не отличаться.

Откройте терминал и используйте следующую команду:

ssh-keygen

Вы должны увидеть результат вроде этого:

Generating public/private rsa key pair.
Enter file in which to save the key (/user_home/.ssh/id_rsa):

Нажмите клавишу ввода и перейдите с выбором по умолчанию. Вас могут попросить ввести пароль для защиты вашего ключа SSH. Если вы устанавливаете пароль, вам придется вводить его каждый раз, когда вы пытаетесь установить SSH-соединение, используя сгенерированный SSH-ключ. Вы можете или не можете установить пароль для ключа SSH.

Добавление открытого ключа SSH в GitLab

Если вы создали ключ SSH на своем персональном компьютере, вы должны найти его в каталоге .ssh вашего домашнего каталога в большинстве дистрибутивов Linux. Отобразите его содержимое с помощью этой команды:

cat ~/.ssh/id_rsa.pub

Скопируйте содержимое вашего открытого ключа. Теперь войдите в свою учетную запись GitLab, перейдите в «Настройки пользователя» и найдите ключи SSH на левой боковой панели. Кроме того, вы можете просто перейти на эту страницу при входе в систему.

Вы увидите поле для добавления открытого ключа. Просто вставьте ключ сюда. Дайте ему название, чтобы легко распознать, какому компьютеру принадлежит этот ключ. Если вы не сделали что-то самостоятельно, у ключей SSH нет срока действия по умолчанию. Так что оставьте поле истечения нетронутым.

Сделано со всем? Нажмите кнопку «Добавить ключ».

Вы можете добавить более одного ключа SSH. Это нормально, если у вас более одного компьютера.

Проверьте, можете ли вы отправить код в GitLab сейчас

Итак, вы добавили свой SSH-ключ в свой профиль GitLab. Теперь все должно быть хорошо. Время проверить это.

Попробуйте нажать свой код еще раз. Посмотри, работает ли это. Обычно вы должны видеть вывод, как этот, если он успешен:

destroyer@andreyex:~/Documents/Local-Code$ git push -u origin master
Username for 'https://gitlab.com': gitlab_account_username
Password for 'https://gitlab_account_username@gitlab.com': 
Enumerating objects: 127, done.
Counting objects: 100% (127/127), done.
Delta compression using up to 4 threads
Compressing objects: 100% (122/122), done.
Writing objects: 100% (127/127), 401.30 KiB | 6.37 MiB/s, done.
Total 127 (delta 14), reused 0 (delta 0)
remote: Resolving deltas: 100% (14/14), done.
To https://gitlab.com/gitlab_account_username/gitlab_repository.git
 * [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

Все еще видите ошибку? Имейте в виду разницу между именем пользователя профиля GitLab и именем пользователя учетной записи!

Это нелегко.

GitLab имеет два имени пользователя: имя пользователя профиля и имя пользователя учетной записи.

Вы можете легко изменить имя пользователя профиля без каких-либо последствий. Но изменение имени пользователя аккаунта может привести к катастрофическим последствиям.

Имя пользователя учетной записи – это то, что вы увидите в URL вашего репозитория GitLab:

https://gitlab.com/gitlab_account_username/repository_name

При создании нового репозитория GitLab со своего веб-сайта GitLab предложила использовать имя пользователя профиля в настройках Git config на персональном компьютере.

Мы сделали это и попытались использовать одно и то же имя пользователя профиля, передавая код в хранилище. Неудивительно, что это было отклонено даже после добавления ключа SSH:

destroyer@andreyex:~/Documents/Local-Code$ git push -u origin master
Username for 'https://gitlab.com': gitlab_profile_username
Password for 'https://gitlab_profile_username@gitlab.com': 
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'https://gitlab.com/gitlab_account_username/gitlab_repository.git/'

Итак, хитрость заключается в том, чтобы использовать здесь имя пользователя учетной записи GitLab. Когда мы это сделали, передача в удаленный репозиторий GitLab прошла успешно.

Это сработало для вас?

Мы надеемся, что это помогло вам с ошибкой «fatal: Authentication fail».

Это сработало для вас? Дайте нам знать с да или нет в разделе комментариев.

Если вы нашли ошибку, пожалуйста, выделите фрагмент текста и нажмите Ctrl+Enter.

So, the other day I thought of using my long-forgotten GitLab account for storing and tracking all the customization I make to the Linux Handbook website.

I created a new repository on the GitLab web interface and I went on to push the directory I had on my personal system.

Everything was fine until I tried to push the code to remote repository on GitHub. It gave me a fatal error saying «Authentical failed for xyz repository».

Here’s what the error looked like:

[email protected]:~/Documents/Local-Code$ git push -u origin master
Username for 'https://gitlab.com': gitlab_profile_username
[email protected]': 
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'https://gitlab.com/gitlab_account_username/gitlab_repository/'

If you are facing a similar issue, let me show you how to fix this error.

Handling «remote: HTTP Basic: Access denied» Error With GitLab

The main line that gives some clue about the root cause of this error is this one:

remote: HTTP Basic: Access denied

Why do I say that? Because your GitLab repository is using HTTPS. It expects to have a secure connection between your system and your repository.

Now, should it not be automatically using HTTPS? No! Not anymore.

GitLab has changed its policy and it now expects you to use your own SSH key to authenticate with your GitLab repository.

SSH key in GitLab prompt

In other words, to push a code from your local system to your remote GitLab repository, you must create an SSH key-pair and add the public key to your GitLab profile.

I am using Linux so the steps are best followed on Linux. If you are using Windows or macOS, you should take a hint and check how to do the same on your operating system.

First check if you already have SSH keys:

ls ~/.ssh/id_rsa.pub

If you don’t have it, create it using the next section else jump to the section after this one.

Creating SSH keys (if you don’t have it already)

I am using Ubuntu so the steps are for Ubuntu. If you are using some other distributions, the steps may or may not be different.

Open a terminal and use the following command:

ssh-keygen

You should see an output like this:

Generating public/private rsa key pair.
Enter file in which to save the key (/user_home/.ssh/id_rsa):

Press the enter key and go with the default choice. You may be asked to enter a password to secure your SSH key. If you set a password, you’ll have to enter it every time you try to make a SSH connection using the generated SSH key. You may or may not set a password for the SSH key.

10 Actionable SSH Hardening Tips to Secure Your Linux Server

Worried about the security of your Linux server? Learn some easy to implement tips on securing SSH and make your Linux server more secure.

Linux HandbookAbhishek Prakash

Adding public SSH key to GitLab

If you have created SSH key on your personal computer, you should find it in the .ssh directory under your home directory in most Linux distributions. Display its content with this command:

cat ~/.ssh/id_rsa.pub

Copy the content of your public key. Now log in to your GitLab account, go to User Settings and look for SSH keys in the left sidebar. Alternatively, you can just go to this page when logged in.

You’ll see a field for adding the public key. Just paste the key here. Give it a title to easily recognize which computer this key belongs to. Unless you did something on your own, SSH keys don’t have an expiry date by default. So leave the expiry field untouched.

Done with everything? Hit the Add key button.

adding ssh key to GitLab

You can add more than one SSH keys. That’s normal if you have more than one computer.

Check if you can push the code to GitLab now

So, you added your SSH key to your GitLab profile. Things should be good now. Time to verify it.

Try to push your code again. See if it works. Normally, you should see an output like this if it is successful:

[email protected]:~/Documents/Local-Code$ git push -u origin master
Username for 'https://gitlab.com': gitlab_account_username
Password for 'https://[email protected]': 
Enumerating objects: 127, done.
Counting objects: 100% (127/127), done.
Delta compression using up to 4 threads
Compressing objects: 100% (122/122), done.
Writing objects: 100% (127/127), 401.30 KiB | 6.37 MiB/s, done.
Total 127 (delta 14), reused 0 (delta 0)
remote: Resolving deltas: 100% (14/14), done.
To https://gitlab.com/gitlab_account_username/gitlab_repository.git
 * [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

Still see error? Mind the difference between GitLab profile username and the account username!

I learned it the hard way.

GitLab has two usernames: profile username and account username.

You can easily change the profile username without any consequences. But changing the account username can be catastrophic.

The account username is what you’ll see in the URL of your GitLab repository:

https://gitlab.com/gitlab_account_username/repository_name

While creating a new GitLab repository from its website, GitLab suggested using the profile username in the Git config settings on the personal computer.

I did that and I tried to use the same profile username while pushing the code to the repository. Unsurprisingly, it got denied even after adding the SSH key:

[email protected]:~/Documents/Local-Code$ git push -u origin master
Username for 'https://gitlab.com': gitlab_profile_username
Password for 'https://[email protected]': 
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'https://gitlab.com/gitlab_account_username/gitlab_repository.git/'

So, the trick is to use the GitLab account username here. When I did that, the push to the remote GitLab repository was successful.

Did it work for you?

Well, I shared my ordeal with pushing code to GitLab repository. I hope this helped you with the «fatal: Authentication failed» error as well.

Did it work for you? Do let me know with a yes or no in the comment section.

Abhishek Prakash

Creator of Linux Handbook and It’s FOSS. An ardent Linux user & open source promoter. Huge fan of classic detective mysteries from Agatha Christie and Sherlock Holmes to Columbo & Ellery Queen.

Im пытается нажать на github с sourcetree, но получить следующую ошибку:

git-c разница.mnemonicprefix=ядро false-C.quotepath=false push-v
— теги origin live_version: live_version remote: неверное имя пользователя или пароль. неустранимо: ошибка проверки подлинности
‘https://github.com/myname/myrepo/ ‘ толкая к
https://github.com/myname/myrepo

завершено с ошибками, см. выше.

enter image description here
Однако, когда я иду в

инструменты > аутентификация > Моя учетная запись GitHub

и нажмите Изменить > обновить маркер oauth
enter image description here
Открывается страница, и я получаю:

Аутентификация Прошла Успешно

SourceTree has been successfully authenticated. You may now close this page.

Он всегда работал, но внезапно остановился, у меня нет двухфакторной аутентификации.
Я попытался удалить учетную запись и добавить ее снова безрезультатно.
Как я могу получить соединение снова работает, чтобы я мог подтолкнуть свой проект к github.

Sourcetree версии 2.1.8.0

7 ответов


Я нашел ответ!—2—>здесь, Это известная ошибка для версии 2.1.8+

следующие шаги исправили это для меня:

Tools > Options > Git > Update Embedded Git

также работает нажатие с помощью командной строки.

87

автор: Sven van den Boogaart


Я много боролся с этим, что решило это для меня на моем Mac:

  • открыть finder, нажмите Cmd + Shift + g
  • enter ~ / библиотека / приложение/
  • Поддержка Приложений
  • перейдите в папку SourceTree
  • удалить имя пользователя @STAuth-bitbucket.org
  • Открыть Брелок Доступа
  • поиск sourctree
  • удалить элемент «login»
  • клонировать источник из bitbucket
  • брелок попросит вас bitbucket pass


У меня была такая же проблема , я Relogged в учетной записи решена эта ошибка для меня.


У меня была та же проблема, и я исправил ее установка последней версии git для windows


для SourceTree 2.7.6 для macOS с использованием встроенного git я следовал всем предложенным ответам, но все равно имел ту же проблему.

решением для меня было отключить двухфакторную аутентификацию.

очевидно, не идеально, но иногда вам просто нужно сделать свою работу.


в Windows попробуйте:

  1. Инструменты> Параметры> аутентификация-удалить из Git сохраненный пароль Ваши данные РЕПО проблемы (ex login@repo.com)
  2. выберите вкладку с проблемным РЕПО.
  3. откройте терминал и сделайте команду git (ex git pull origin), и вам будет предложено войти и пароль. Введите правильный логин и пароль. Логин и пароль будут обновлены, и все будет работать снова.

Это может показаться чем-то вроде элементарной проблемы, но я не могу перейти от Sourcetree (windows) к хранилищу репозиториев, владельцем которого является мой пользователь.

Чтобы уточнить, я могу просто войти в репозиторий, используя мой браузер, но когда я нажимаю на него из Sourcetree и ввожу те же данные в окно приглашения, проверка подлинности не выполняется. Я попытался использовать имя пользователя и адрес электронной почты, я даже изменил пароль учетной записи, но все равно не радости.

Я также создал пароль для приложения и попытался использовать его в качестве пароля с комбинациями имени пользователя и электронной почты, но без радости.

Ошибка, которую я получаю:

git -c diff.mnemonicprefix = false -c core.quotepath = false -no-необязательно-блокирует -c credential.helper = -c credential.helper = «C: / Users // AppData / Local / ATLASS ~ 1 / SOURCE ~ 1 / GIT_EX ~ 1 / GIT-CR ~ 1.EXE «push -v —tags origin master: master fatal: HttpRequestException обнаружена. Произошла ошибка при отправке запроса.

удаленный: Неверное имя пользователя или пароль. Если ваша организация управляет или вы включили двухэтапную проверку, создайте приложение пароль для входа в систему: https://confluence.atlassian.com/x/9DJmMQ. Ошибка аутентификации для ‘ Https: //@bitbucket.org//.git/ ‘

Нажав на https: //@bitbucket.org//.git Завершено с ошибками, см. Выше.

Любой совет будет очень признателен

3 ответа

Лучший ответ

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

Понравилась статья? Поделить с друзьями:
  • Source 11 brakes ошибка
  • Soundwire ошибка unable to connect soundwire server
  • Soundflower установщик обнаружил ошибку
  • Sound forge ошибка при открытии кодека
  • Soft 301 лада веста ошибка