Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error encountered while cloning the remote repository with VS 2015 Update 3 (TFS 2015 Update 3)

I have recently upgraded to VS 2015 (Update 3) on the client side and TFS 2015 (Update 3) on server side. The Git operations worked for a while, then I started getting following error when trying to clone a git repo:

Error encountered while cloning the remote repository: 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

But I can navigate to repo in the browser without any problems. Then, I figured this may due my client side settings. I tried removing the VS cache as well as TFS cache. Nothing worked. When I used Fiddler, it should following information:

It revealed following information:

Request 1:
GET https://myhost/tfs/transact/Transact/_git/MY-REPO/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/1.0 (libgit2) Team Foundation (devenv.exe, 14.102.25521.0, Enterprise, SKU:37)
Host: myhost
Accept-Encoding: gzip
Connection: Keep-Alive

Response 1:
HTTP/1.1 401 Unauthorized
...
Request 2:
GET https://myhost/tfs/transact/Transact/_git/MY-REPO/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/1.0 (libgit2) Team Foundation (devenv.exe, 14.102.25521.0, Enterprise, SKU:37)
Accept-Encoding: gzip
Authorization: NTLM TlRMTVNTUAABAAAAB4IIogAAAAAAAAAAAAAAAAAAAAAKAEM6AAAADw==
Host: myhost

Response 2:
HTTP/1.1 401 Unauthorized

With this information, I searched for libgit2*.* file in my visual studio folders. I found several instances of LibGit2Sharp.dll. All of them have same version (0.22.0.0) but one instance had the version 14.0.25029.0. I tried copy the version 0.22.0.0 over on top of 14.0.25029.0. But visual studio complained about it during launch. The folder with 14.* version is found in "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions" folder and it contains several dlls that start with "Microsoft.TeamFoundation.". All of those dlls have the version: 14.102.25521.0 (which is what I found in the fiddler trace).

Looks like I am at the right problem area but not sure how to fix the error.

Any ideas?

like image 766
Raghu Avatar asked Sep 12 '16 05:09

Raghu


1 Answers

After struggling with the above problem for a week, I posted the question today. But right after posting, I landed on a solution.

It has nothing to do with visual studio/tfs upgrade. I must have entered wrong tfs credential information (while checking remember me box). With remember me feature, the team explorer never gave me a chance to correct the credential information and probably kept using stored wrong credentials. Here is what I had to do to correct the issue:

  1. Control Panel\User Accounts\Credential Manager
  2. Remove any tfs related credentials.
  3. Launch visual studio
  4. It will now prompt you for tfs credential information.

Problem solved.

The following post (though dated) helped me in solving the problem: https://blogs.msdn.microsoft.com/visualstudioalm/2012/08/29/clearing-the-credentials-for-connecting-to-a-team-foundation-server/

like image 52
Raghu Avatar answered Sep 22 '22 13:09

Raghu