Vy Do
Vy Do

Reputation: 52516

HTTP Basic: Access denied fatal: Authentication failed

I use GitLab Community Edition 9.1.3 2e4e522 on Windows 10 Pro x64. With Git client.

Error

Cloning into 'project_name'...
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'http://[email protected]/my_user_name/project_name.git/'

How to fix it?

Upvotes: 61

Views: 273933

Answers (19)

dat_dat
dat_dat

Reputation: 1

This happened to me after my access token expired.

  1. Follow Gitlab's instructions to generate a PAT. Copy and paste the token.
  2. Go to Credential Manager (you can find this in Control Panel > User Accounts)
  3. Edit the password for git:https://gitlab.com replacing it with the PAT you generated.

Upvotes: 0

Robert
Robert

Reputation: 1

For anyone getting the error:

remote: HTTP Basic: Access denied fatal: Authentication failed for xxxxx

Make sure your gitlab user name DOES NOT contain a dash.

For example, I had: [email protected] which returned the error above.

I changed it to: [email protected], and it did not return the error.

Upvotes: 0

stderr: remote: HTTP Basic: Access denied fatal: Authentication failed for

I found out that I got this error because I entered the wrong password in the credential on Jenkins. When I made sure I typed the correct password, my problem was solved. git fetch etc. via server. You can run a command and make sure that the username and password are correct.

Upvotes: 0

benjamin
benjamin

Reputation: 383

I solved with:

  1. Deleting the github credential from the windows credentials,
  2. Adding a new credential like in this answer (the password is the PAT)

Upvotes: 0

Siddhi Kamat
Siddhi Kamat

Reputation: 155

If username and password is prompted. Just add Gitlab username and password for clone.

For pop up dialog asking credential, follow the steps below.

  1. Go to "control panel"
  2. user accounts
  3. manage credentials
  4. windows credentials
  5. git:https://[email protected]
  6. click on down arrow
  7. Click remove.

Hope this helps!

Upvotes: 6

shdr
shdr

Reputation: 966

i coped with same error and my suggestion are:

  1. Start with try build another user in git lab
  2. Recheck username & password (although it sounds obvious)
  3. Validate the windows credential (start -> "cred")
  4. Copy & paste same URL like you get from git lab, the struct should be:

http://{srvName}/{userInGitLab}/{Repository.git} no '/' at the end

  1. Recheck the authorization in GitLab
  2. Give an attention to case sensitive

Hope one of the above will solve it.

Upvotes: 8

Sahil Kashyap
Sahil Kashyap

Reputation: 359

in ubuntu 20.04 ,

vscode terminal was unable to pull/push returned this error

remote: HTTP Basic: Access denied
fatal: Authentication failed for

Simply opened regular terminal in the folder location git pull/push worked properly

Upvotes: 4

LaurinO
LaurinO

Reputation: 136

The updating of the password in the windows credential manager was not the solution for me.

I had to set a different remote url, by:

git remote set-url origin https://gitlab....git

The url in this case was the one that could be found in Gitlab under Clone -> Clone with HTTPS. It was not the one in the command line instructions.

Upvotes: -1

Manasvi Mittal
Manasvi Mittal

Reputation: 250

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

Upvotes: 3

Sitecore Sam
Sitecore Sam

Reputation: 377

  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

Upvotes: 4

Deb
Deb

Reputation: 151

For my case, I initially tried with

git config --system --unset credential.helper

But I was getting error

error: could not lock config file C:/Program Files/Git/etc/gitconfig: Permission denied

Then tried with

git config --global --unset credential.helper

No error, but still got access denied error while git pulling.

Then went to Control Panel -> Credentials Manager > Windows Credential and deleted git account.

After that when I tried git pull again, it asked for the credentials and a new git account added in Credentails manager.

Upvotes: 14

Aditya
Aditya

Reputation: 341

I use VS Code on my mac OS and GitLab for my project. I tried so many ways but it worked simply for me by resetting the remote origin of your project repository with the below command:

cd <local-project-repo-on-machine>
git remote set-url <remote-name> <remote-url>

for ex: git remote set-url origin https://<project-repository>.git

Hope it helps someone.

Upvotes: 1

AnonymusHelperq
AnonymusHelperq

Reputation: 51

This can happen also because of a change in the password and since Git Credential Manager caches it, so if that's the case 1. Open Credential Manager in Windows 2. Search for your GIT credential and reset it to the new password.

Upvotes: 5

sai
sai

Reputation: 319

Go to your Credential manager => git credentials Check your git credentials and check your password.

This worked for me.

Upvotes: 4

Predhin Sapru
Predhin Sapru

Reputation: 1

Edit the entry(possibly the password field that may have changed) for git: inside Generic Credentials section of Windows Credentials which can be accessed from Control Panel. Please note this is for Windows OS.

Upvotes: 0

KlevisGjN
KlevisGjN

Reputation: 691

Im my case i was using Git Credential Manager for Windows (it was installed by default, I didn't install it manually)

Credentials Manager had saved my old password but i changed it lately.

If you are in the same conditions, to solve this problem: Go to Control Panel -> Credentials Manager and delete git account. After that it will ask you again for the credentials.

Upvotes: 28

jsimon
jsimon

Reputation: 27

A simple git fetch/pull command will throw a authentication failed message. But do the same git fetch/pull command second time, and it should prompt a window asking for credential(username/password). Enter your Id and new password and it should save and move on.

Upvotes: 1

Rohit Poudel
Rohit Poudel

Reputation: 1889

  • Try if it works on the Git Bash
  • Have you added a ssh key to your account? If yes remove it and try again. If not add one and try the ssh url.
  • You don't necessarily need Tortoise Git but it may also work around your problem
  • Try to re-install Git without the Git Credential Manager for Windows

When you've fixed the push problem you will also be able to clone it when it is private or internal.

Upvotes: -2

Vy Do
Vy Do

Reputation: 52516

Open CMD (Run as administrator) type command:

git config --system --unset credential.helper

then enter new password for Git remote server.

Upvotes: 94

Related Questions