Visual Studio - Remote: HTTP Basic: Access denied Error encountered while cloning the remote repository: Git failed with a fatal error

Ian Fako picture Ian Fako · May 23, 2018 · Viewed 9.8k times · Source

I'm working with Visual Studio and am trying to clone a online repo from a server where gitlab is running. Let's call the server https://gitlab.example.com

I get the following error when I try to clone the repo

Remote: HTTP Basic: Access denied
Error encountered while cloning the remote repository: Git failed with a fatal error.
Authentication failed for 'https://gitlab.example.com/username/test.git/'

When I try it, I get promted to enter a username and password for the server. I entered the user credentials of the user which created the repo.

I've found a similar problem with an answer here on stackoverflow, but this didn't work for me.

I am using Visual Studio 2017 Enterprise 15.7.2

Answer

Sandeep Ahuja picture Sandeep Ahuja · Aug 14, 2018

Windows must have saved your git credentials which needs to be updated/remove. Below steps worked for me in VS2017.

Go to "Credential Manager" from Windows "Start" and under "Generic Credentials" select your git url. Click on the right side arrow, it should expand and you should see two links "Edit" & "Remove from vault".

Click on latter link (recommendable), restart VS, open your project & do a sync/pull request, it should ask your credentials to enter and you should be good to go. Thanks