Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 563
Ian Fako Avatar asked May 23 '18 11:05

Ian Fako


People also ask

How do I fix Git failed fatal error?

Head over to the Git website and install the latest version of Git for Windows. Go back into the Visual Studio installer and tick "Git for Windows" again. It will not download a new version even though it may look like it is. After that is done, your Git should be fine with VSTS and TF Explorer.

How do I clone a repository in Visual Studio?

Open Visual Studio. On the start window, select Clone a repository. Enter or type the repository location, and then select the Clone button. You might be asked for your user sign-in information in the Git User Information dialog box.


1 Answers

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

like image 97
Sandeep Ahuja Avatar answered Oct 08 '22 16:10

Sandeep Ahuja