git 使用 VS 2015 Update 3 (TFS 2015 Update 3) 克隆远程存储库时遇到错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39443646/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:16:07  来源:igfitidea点击:

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

gittfsazure-devopslibgit2libgit2sharp

提问by Raghu

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:

我最近在客户端升级到 VS 2015(更新 3),在服务器端升级到 TFS 2015(更新 3)。Git 操作工作了一段时间,然后在尝试克隆 git 存储库时开始出现以下错误:

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:

但是我可以毫无问题地导航到浏览器中的 repo。然后,我想这可能是由于我的客户端设置造成的。我尝试删除 VS 缓存以及 TFS 缓存。没有任何效果。当我使用 Fiddler 时,它应该遵循以下信息:

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).

有了这些信息,我在我的 Visual Studio 文件夹中搜索了 libgit2*.* 文件。我发现了 LibGit2Sharp.dll 的几个实例。它们都具有相同的版本 (0.22.0.0),但一个实例的版本为 14.0.25029.0。我尝试将 0.22.0.0 版本复制到 14.0.25029.0 之上。但是visual studio在发布期间抱怨它。14.* 版本的文件夹位于“C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions”文件夹中,它包含几个以“Microsoft.TeamFoundation.”开头的dll。所有这些 dll 都有版本:14.102.25521.0(这是我在提琴手跟踪中找到的)。

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

看起来我在正确的问题区域,但不确定如何修复错误。

Any ideas?

有任何想法吗?

回答by Raghu

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:

它与 Visual Studio/tfs 升级无关。我一定输入了错误的 tfs 凭据信息(在选中“记住我”框时)。使用记住我功能,团队浏览器从未给我机会更正凭据信息,并且可能一直使用存储的错误凭据。这是我必须做的来纠正这个问题:

  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.
  1. 控制面板\用户帐户\凭据管理器
  2. 删除任何与 tfs 相关的凭据。
  3. 启动视觉工作室
  4. 它现在会提示您输入 tfs 凭据信息。

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/

以下帖子(虽然过时)帮助我解决了这个问题:https: //blogs.msdn.microsoft.com/visualstudioalm/2012/08/29/clearing-the-credentials-for-connecting-to-a-team-基础服务器/