简体   繁体   中英

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

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

You need to provide Gitlab username and password in your url.

So, instead of

https://gitlab.com/username/test.git/

use this url

https://YOUR_GITLAB_USERNAME:PASSWORD@gitlab.com/username/test.git/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM