git-tfs返回"(401)未授权"克隆存储库时出错

时间:2015-04-17 15:31:26

标签: git-tfs

我使用git-tfs来处理TFVC存储库。我开始研究其他项目,项目的代码托管在不同的服务器上。

现在,当我尝试克隆存储库时,我遇到了错误。

git tfs clone http://tfs-server:8080/tfs $/CompanyName/Dev

它提示我输入凭据两次。然后它显示错误。

TF30063: You are not authorized to access http://tfs-server:8080/tfs.
The remote server returned an error: (401) Unauthorized.

我已经仔细检查过它是一个正确的网址。我可以使用Visual Studio和浏览器进行连接。

我已经仔细检查过它是一个正确的密码和用户名。我可以在浏览器中使用此凭据登录。

我可以从我机器上的其他服务器克隆代码。

服务器是Visual Studio Team Foundation Server 2013.我的git-tfs版本是

git-tfs version 0.21.0.0 (TFS client library 12.0.0.0 (MS)) (64-bit)

我发现了一些类似错误的问题并尝试了答案。所以这些是我试图做的事情:

  • 在Visual Studio的浏览器中从此服务器注销;
  • 清理Internet Explorer缓存
  • 删除C:\ Users \ UserName \ AppData \ Local \ Microsoft \ Team Foundation \ 5.0 \ Cache文件夹;
  • 在Internet Explorer中将tfs服务器添加到本地Intranet安全区域。

这是调试输出:

git tfs clone http://tfs-server:8080/tfs $/CompanyName/Dev --debug

Command run:git tfs clone http://tfs-server:8080/tfs $/CompanyName/Dev --debug
No authors file used.
git-tfs version 0.21.0.0 (TFS client library 12.0.0.0 (MS)) (64-bit)
git command: Starting process: git init
Initialized empty Git repository in C:/Users/UserName/Dev/.git/
git command time: [00:00:00.0660000] init
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.TeamFoundation.TeamFoundationServerUnauthorizedException: TF30063: You are not authorized to access http://tfs-server:8080/tfs. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
   at System.Net.HttpWebRequest.GetResponse()
   at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequestAndGetResponse(HttpWebRequest webRequest, WebException& webException)
   --- End of inner exception stack trace ---
   at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.ReadResponse(HttpWebResponse webResponse, WebException webException)
   at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequest()
   at Microsoft.TeamFoundation.Client.Channels.TfsHttpRequestChannel.Request(TfsMessage message, TimeSpan timeout)
   at Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.Invoke(TfsClientOperation operation, Object[] parameters, TimeSpan timeout, Object[]& outputs)
   at Microsoft.TeamFoundation.Framework.Client.RegistrationProxy.GetRegistrationEntries(String toolId)
   at Microsoft.TeamFoundation.Framework.Client.RegistrationService.GetInstanceId()
   at Microsoft.TeamFoundation.Framework.Client.RegistrationService.get_InstanceClientCacheDirectory()
   at Microsoft.TeamFoundation.Framework.Client.RegistrationService..ctor(TfsTeamProjectCollection tfsObject)
   at Microsoft.TeamFoundation.Client.TfsTeamProjectCollection.CreateServiceProxy(Type serviceType)
   at Microsoft.TeamFoundation.Client.TfsConnection.GetService(Type serviceType)
   at Microsoft.TeamFoundation.Framework.Client.PreFrameworkServerDataProvider.FindServiceLocation(String serviceType, String toolId)
   at Microsoft.TeamFoundation.Framework.Client.PreFrameworkServerDataProvider.LocationForCurrentConnection(String serviceType, Guid serviceIdentifier)
   at Microsoft.TeamFoundation.Client.TfsConnection.EnsureProviderConnected()
   at Microsoft.TeamFoundation.Client.TfsConnection.EnsureAuthenticated()
   at Sep.Git.Tfs.VsCommon.TfsHelperBase.EnsureAuthenticated()
   at Sep.Git.Tfs.Core.GitTfsRemote.EnsureTfsAuthenticated()
   at Sep.Git.Tfs.Core.GitRepository.CreateTfsRemote(RemoteInfo remote, String autocrlf, String ignorecase)
   at Sep.Git.Tfs.Commands.Init.Run(String tfsUrl, String tfsRepositoryPath)
   at Sep.Git.Tfs.Commands.Clone.Run(String tfsUrl, String tfsRepositoryPath, String gitRepositoryPath)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Sep.Git.Tfs.Util.GitTfsCommandRunner.Run(GitTfsCommand command, IList`1 args)
   at Sep.Git.Tfs.GitTfs.Main(GitTfsCommand command, IList`1 unparsedArgs)
   at Sep.Git.Tfs.Program.Main(String[] args)
TF30063: You are not authorized to access http://tfs-server:8080/tfs.
The remote server returned an error: (401) Unauthorized.

我该怎样做才能让我的git-tfs回流?

1 个答案:

答案 0 :(得分:2)

我已经将收藏名称添加到服务器的网址中,但它确实有效。

正确的命令是:

git tfs clone http://tfs-server:8080/tfs/collectionName $/CompanyName/Dev

虽然问题中的命令适用于以前的服务器。