[Solved] GitLab remote: HTTP Basic: Access denied and fatal Authentication

I am on mac OS unlike this post:

I have password configured in GitLab.

I have 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:

Existing folder

cd existing_folder
git init
git remote add origin
git add .
git commit -m "Initial commit"
git push -u origin master

I am prompted to enter my GitLab username and password.
After password is entered I get:

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

Enquirer: jeancode


Solution #1:

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

Try below solution which works for me:

  1. Go to Windows Credential Manager. This is done in a 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

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

Solution #2:

   git config --system --unset credential.helper

then enter new password for Git remote server.

Respondent: hatanooh

Solution #3:

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, go to: (Right corner) Personal Profile->Settings-> Access Tokens
  • enter image description here
  1. Create a new personal access token (check api)
  • enter image description here
  1. git clone ...
  2. When you are asked for your password, copy and paste the access token instead of your GitLab password
  • enter image description here
Respondent: JavAlex

Solution #4:

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…

Respondent: Bharti Ladumor

Solution #5:

The only thing that worked for me was using https://username:[email protected]/user/projectgit instead of See

Respondent: Paulo Morgado

Solution #6:

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

Respondent: Andy Quiroz

Solution #7:

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

Respondent: Kshama Jain

Solution #8:

Just add your username before the domain:


And the assistant will ask you the password

Respondent: gal007

Solution #9:

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


Respondent: Pigueiras

Solution #10:

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.

Respondent: Vikash Pandey

Solution #11:

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.
Respondent: VonC

Solution #12:

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


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

Respondent: Manasvi Mittal

Solution #13:

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

Respondent: Dyno Cris

Solution #14:

Try this:

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

Solution #15:

Open command prompt as administrator then run this command:

git config --system --unset credential.helper

Solution #16:

I beleive I’m little late here. But I think this would help the new peeps!

My Errors were:
remote: HTTP Basic: Access denied

remote: You must use a personal access token with ‘read_repository’ or ‘write_repository’ scope for Git over HTTP.

remote: You can generate one at

fatal: Authentication failed for ‘

I’m on Ubuntu but this worked for me:

  1. Goto
  2. Create new token and mark check to all.
  3. Copy your token
  4. Now go to your Terminal and paste it like this.

git clone https://oauth2:[email protected]/PROFILE_NAME/REPO_NAME.git/

Respondent: Gaurav

Solution #17:

There are two ways I got around this problem:

  1. I added my username to the front of the remote URL (https://[email protected])

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

Respondent: Artorias2718

Solution #18:

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

Respondent: SanjX

Solution #19:

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[username]/[repo-name].git

Respondent: Sitecore Sam

Solution #20:

Same problem with Sourcetree On Mac

Solution: Delete the password in keychain access.

enter image description here

When you try to push again it will ask for your password.

Respondent: rotoava

Solution #21:

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

Respondent: saiedkia

Solution #22:

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!

Respondent: Andreas Forslöw

Solution #23:

it worked for me: I use Mac and I wrote the path on finder:

~/Library/Application Support/SourceTree

I deleted the auth file which should be like

[email protected]

then tried to push and pull the code from the source tree and it worked.

You can also read the following answers:

Respondent: Burcu Kutluay

Solution #24:

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.
Respondent: vikash kumar

Solution #25:

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 = [email protected]:prat3ik/my-project.git

And it was working!!

Respondent: Pratik Patel

Solution #26:

GO TO C:Users<<USER>> AND DELETE THE .gitconfig file then try a command that connects to upstream like git clone, git pull or git push. You will be prompted to re-enter your credentials. Kindly do so.

Respondent: Dennis Mutegi

Solution #27:

When I had the same problem,

I solved it by removing the file “passwd” in


After removing Sourcetree will prompt for the password.

OS Version : win10 
Sourcetree Version:  3.1

Solution #28:

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.

Respondent: ATOMP

Solution #29:

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.
Respondent: Gani

Solution #30:

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.

Respondent: Momchill

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy