问题
Same problem here: Error encountered while cloning the remote repository with VS 2015 Update 3 (TFS 2015 Update 3)
But that solution doesn't work for me. Please read the full question.
I received the following error when I tried to clone TFS git repository:
Error encountered while cloning: An error occurred while sending the
request.
Inner Exception:
The remote server returned an error: (401) Unauthorized.
Inner Exception:
No credentials are available in the security package
I did not find any other log details.
I verified that I am able to access TFS repository on the web. I can also clone using Git bash. So it seems to be a problem with Visual Studio storing my credentials.
as per the solution mentioned here, I don't want to delete all credentials for different TFS servers I am connected to.
- I have https://tfs.CodePlex.com/tfs TFS credentials
- I have my personal https://myAccountName.VisualStudio.com credentials and
- I am now connected to my company's tfs http://ipAddress:8080/tfs credentials
First two works fine, I can any time switch to those accounts from Team Explorer but the 3rd one is not working.
Not sure, how to trouble-shoot it
回答1:
401 Unauthorized:
If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused for those credentials.
Just as your guess, this may be a problem with Visual Studio storing my credentials. You could first give a try with clear VS cache.
If it's not work, you may need to change the account info which cached in VS for your company's TFS credentials. Unlike VSTS, you can't switch user or log out directly for on-premise TFS.
You have to delete the account info in Windows-Control Panel- Credential Manager. You could give a try with only deleting the company's TFS credentials which based on TFS link address.
You may have to remove any tfs related credentials if it's still not working. No need to worry about other two servers, what you have to do is just re-entering your account info/password for them.
回答2:
Finally this is how I resolved the issue
- TFS site was using only NTML authentication I added Negotiate on top it and removed anonymous access.
- I had a second issue not able to access the TFS site via domain name and was only accessble via IP address. To enable domain name access instead of IP address, I added registry keys for “DisableStrictNameChecking” and “DisableLoopbackCheck”.
回答3:
In my case i was connecting to TFS from my TEST domain where NETBIOS name matched but fully qualified name was different.
When logging in with NETBIOS\username it failed auth. when logging in with FQDN\username it succeeded.
来源:https://stackoverflow.com/questions/44157631/tfs-git-clone-using-visual-studio-2015-gives-401-unauthorized-error