0

When i'm using Team Explorer in Visual Studio 2015 and trying to fetch repo from a local TFS, i get the bellow error:

Error encountered while fetching: An error occurred while sending the request.

Inner Exception:
The remote server returned an error: (401) Unauthorized.

Inner Exception:
    The system cannot contact a domain controller to service the authentication request. Please try again later
Error encountered while fetching: An error occurred while sending the request.

When i'm using cmd and i execute the command git fetch is working.

Please help me with any suggestion to fix this error.

1 Answers1

0

First you could try to narrow down if the issue is related to cached credentials in Visual Studio (Maybe you enter wrong Account Info, wrong password or password changed)

  1. Delete credentials in the Credential Manager from control panel
  2. Rename or delete the Git directory in C:/Program Files(x86)/Microsoft Visual Studio/201x/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer little different but similar in Visual Studio 2015
  3. Install the package Git Credential Manager for Windows v1.20
  4. When VS asks for the credential insert them

If this still could not solve your issue. Then it may related to your network or TFS server side setting. Such as you could added Negotiate on top with NTML authentication and removed anonymous access.

More details please take a look at this similar issue: TFS git clone using Visual Studio 2015 gives 401 unauthorized error

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • 1
    I reset the credentials from the **Credential Manager** but it still didn't work. The problem is only in Visual Studio 2015 because in Visual Studio 2017 it works correctly. It is also not a network problem because from **cmd** I can run the commands successfully. Somehow Visual studio fails to authenticate me to TFS because if I try to open TFS in Visual Studio browser I have the following error: **TF400813: Resource not available for anonymous access. Client authentication required.** – Alexandru Ionciu Dec 04 '19 at 13:11
  • @AlexandruIonciu Thanks for your quick response. For this kind of error seems like your TFS server enabled anonymous access. Please check HaBo's answer in this ticket https://stackoverflow.com/questions/44157631/tfs-git-clone-using-visual-studio-2015-gives-401-unauthorized-error and disable anonymous access in IIS of your TFS server and try again. – PatrickLu-MSFT Dec 04 '19 at 13:58
  • I'am not allow to change settings of TFS, is there any solution to force Visual Studio 2015 to use windows authentication ? – Alexandru Ionciu Dec 04 '19 at 14:00
  • @AlexandruIonciu Not totally sure about this, seems not. But you could try to [clear TFS and VS cache](https://blogs.msdn.microsoft.com/willy-peter_schaub/2010/09/15/if-you-have-problems-with-tfs-or-visual-studio-flush-the-user-cache-or-not/). Then after this, you need to enter credentials again, this may do the trick. If this still not work, you will have to contact your TFS Admin to change setting in TFS server and try again. Sorry for any inconvenience. – PatrickLu-MSFT Dec 04 '19 at 14:10
  • @ PatrickLu-MSFT I already deleted the TFS and VS cache and it didn't work. I will try to contact the TFS administrator to change the settings ... Thank you for your time. – Alexandru Ionciu Dec 04 '19 at 14:52
  • @AlexandruIonciu Sure any update, feel free to share it here. – PatrickLu-MSFT Dec 04 '19 at 15:00