【问题标题】:TF31002 error when cloning all history from Azure DevOps TFVC collection to Git with GIT-TFS tool使用 GIT-TFS 工具将所有历史记录从 Azure DevOps TFVC 集合克隆到 Git 时出现 TF31002 错误
【发布时间】:2019-07-25 16:19:27
【问题描述】:

我正在尝试将项目从 Azure DevOps TFVC 迁移到包含所有变更集历史记录的 Azure DevOps Git,而不仅仅是过去 180 天。以防万一,我已使用 Azure DevOps 中包含的工具迁移了过去 180 天的更改。所以现在我在这个项目中有 2 个存储库:

  • 带有 {collection-name} 的 TFVC 集合
  • 使用另一个名称的 Git 存储库。

I asked here 我被困在“将存储库克隆到本地文件夹”步骤中。我已经安装了 Git 并下载了 latest realease of GIT-TFS 工具。

我在 Azure DevOps 上有一个个人和专业帐户{email-account}。我要迁移的项目在个人账户中。我在this official help 之后运行这个命令:

git tfs clone -u {email-account} -p {personal-account-password} https://{devops-username}.visualstudio.com/{collection-name}/ $/{folder-name}/ . --branches=none

当我尝试连接到远程集合时,我从 Visual Studio 2017 Pro 获得了 {collection-name}{folder-name}。我只有这个版本的VS。运行命令后,我得到以下输出:

Initialized empty Git repository in C:/DATA/Git/.git/

TF31002: Unable to connect to this Team Foundation Server: https://{devops-username}.visualstudio.com/{collection-name}.
Team Foundation Server Url: https://{devops-username}.visualstudio.com/{collection-name}.

Possible reasons for failure include:
- The name, port number, or protocol for the Team Foundation Server is incorrect.
- The Team Foundation Server is offline.
- The password has expired or is incorrect.

Technical information (for administrator):
The remote server returned an error: (404) Not Found.
The remote server returned an error: (404) Not Found.
All the logs could be found in the log file: C:\Users\{user}\AppData\Local\git-tfs\git-tfs_log.txt

如果有帮助,这里是日志文件内容:

2019-03-04 11:42:17.4562 [Debug] Trying to get HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\vs\Servicing\14.0
2019-03-04 11:42:17.4816 [Debug] Visual Studio 2015 detected...
2019-03-04 11:42:17.6387 [Debug] git command: Starting process: git rev-parse --show-prefix
2019-03-04 11:42:17.6744 [Debug] git stderr: fatal: not a git repository (or any of the parent directories): .git
2019-03-04 11:42:17.6744 [Debug] git command time: [00:00:00.0396901] rev-parse --show-prefix
2019-03-04 11:42:17.7083 [Debug] Command run:git tfs clone -u {email-account} -p {personal-account-password} https://{devops-username}.visualstudio.com/{collection-name} $/{folder-name} . --branches=none
2019-03-04 11:42:17.7083 [Debug] No authors file used.
2019-03-04 11:42:17.7083 [Debug] git-tfs version 0.29.0.0 (TFS client library 14.0.0.0 (MS)) (64-bit)
2019-03-04 11:42:17.7379 [Debug] Looking for assembly StructureMap.resources, Version=2.6.1.0, Culture=en-US, PublicKeyToken=e60ad81abae3c223 ...
2019-03-04 11:42:17.7379 [Debug] Trying to get HKEY_LOCAL_MACHINE\Software\WOW6432Node\Microsoft\VisualStudio\14.0|InstallDir
2019-03-04 11:42:17.7379 [Debug] Trying to get HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\14.0|InstallDir
2019-03-04 11:42:17.7379 [Debug] Trying to get HKEY_CURRENT_USER\Software\WOW6432Node\Microsoft\WDExpress\14.0_Config|InstallDir
2019-03-04 11:42:17.7379 [Debug] Trying to get HKEY_CURRENT_USER\Software\Microsoft\WDExpress\14.0_Config|InstallDir
2019-03-04 11:42:17.7379 [Debug] Looking for assembly StructureMap.resources, Version=2.6.1.0, Culture=en, PublicKeyToken=e60ad81abae3c223 ...
2019-03-04 11:42:17.7379 [Debug] Trying to get HKEY_LOCAL_MACHINE\Software\WOW6432Node\Microsoft\VisualStudio\14.0|InstallDir
2019-03-04 11:42:17.7379 [Debug] Trying to get HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\14.0|InstallDir
2019-03-04 11:42:17.7379 [Debug] Trying to get HKEY_CURRENT_USER\Software\WOW6432Node\Microsoft\WDExpress\14.0_Config|InstallDir
2019-03-04 11:42:17.7379 [Debug] Trying to get HKEY_CURRENT_USER\Software\Microsoft\WDExpress\14.0_Config|InstallDir
2019-03-04 11:42:17.7379 [Debug] git command: Starting process: git init
2019-03-04 11:42:17.8112 [Info] Initialized empty Git repository in C:/DATA/Git/.git/

2019-03-04 11:42:17.8252 [Debug] git command time: [00:00:00.0767692] init
2019-03-04 11:42:17.8481 [Debug] No .gitignore file specified...
2019-03-04 11:42:18.9405 [Debug] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.TeamFoundation.TeamFoundationServiceUnavailableException: TF31002: Unable to connect to this Team Foundation Server: https://{devops-username}.visualstudio.com/{collection-name}.
Team Foundation Server Url: https://{devops-username}.visualstudio.com/{collection-name}.

Possible reasons for failure include:
- The name, port number, or protocol for the Team Foundation Server is incorrect.
- The Team Foundation Server is offline.
- The password has expired or is incorrect.

Technical information (for administrator):
The remote server returned an error: (404) Not Found. ---> System.Net.WebException: The remote server returned an error: (404) Not Found.
   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.TfsConnection.EnsureProviderConnected()
   at Microsoft.TeamFoundation.Client.TfsConnection.EnsureAuthenticated()
   at GitTfs.VsCommon.TfsHelperBase.EnsureAuthenticated()
   at GitTfs.Core.GitTfsRemote.EnsureTfsAuthenticated()
   at GitTfs.Core.GitRepository.CreateTfsRemote(RemoteInfo remote, String autocrlf, String ignorecase)
   at GitTfs.Commands.Init.Run(String tfsUrl, String tfsRepositoryPath)
   at GitTfs.Commands.Init.Run(String tfsUrl, String tfsRepositoryPath, String gitRepositoryPath)
   at GitTfs.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 GitTfs.Util.GitTfsCommandRunner.Run(GitTfsCommand command, IList`1 args)
   at GitTfs.GitTfs.Main(GitTfsCommand command, IList`1 unparsedArgs)
   at GitTfs.GitTfs.Run(IList`1 args)
   at GitTfs.Program.Main(String[] args)
2019-03-04 11:42:18.9635 [Error] TF31002: Unable to connect to this Team Foundation Server: https://{devops-username}.visualstudio.com/{collection-name}.
Team Foundation Server Url: https://{devops-username}.visualstudio.com/{collection-name}.

Possible reasons for failure include:
- The name, port number, or protocol for the Team Foundation Server is incorrect.
- The Team Foundation Server is offline.
- The password has expired or is incorrect.

Technical information (for administrator):
The remote server returned an error: (404) Not Found.
2019-03-04 11:42:18.9635 [Error] The remote server returned an error: (404) Not Found.
2019-03-04 11:42:18.9734 [Warn] All the logs could be found in the log file: C:\Users\{user}\AppData\Local\git-tfs\git-tfs_log.txt

【问题讨论】:

  • 我不记得 Azure 是否从早期的 git 支持改变了一些东西,或者你是否应该仍然使用 github.com/git-tfs/git-tfs/blob/master/doc/… 我也希望你的集合名称设置为 DefaultCollection。您也可以尝试不指定登录名和密码,然后会打开一个弹出窗口以输入您的凭据,应该这样做......
  • 谢谢你,把钥匙给我。不知道为什么,我在 DevOps 或者 VS 上看到的项目的集合名称和 DefaultCollection 不一样。设置这个集合名称我做了一些成功的迁移。首先启用备用身份验证凭据并使用 -u 用户名 -p 密码模式,但我必须在弹出窗口上登录。之后,历史下载开始。在另一个测试中,我禁用了备用身份验证凭据,并且没有指定 -u 和 -p 参数并且没有弹出窗口,下载开始了。凭据是否第一次保存在某个地方?

标签: git tfs azure-devops tfvc git-tfs


【解决方案1】:

要在 Azure DevOps 上克隆 TFVC 存储库,您应该:

  • 启用备用凭据。转到“我的个人资料”->“安全”-> 输入数据并“启用备用凭据”
  • 使用遵循此模式的命令(“yourLogin”和“yourPassword”在上一步中定义) git tfs clone https://dev.azure.com/{organization} $/project/folder --username=yourLogin --password=yourPassword

要成功,visualstudio.com 需要(用于身份验证)您使用 TFS2012 版本的 TFS dll。否则,您将看到消息:

TF400813: Resource not available for anonymous access. Client authentication required

要确保 git-tfs 使用此版本,请使用命令 git tfs --version,您应该会看到文本 TFS client library 11.0.0.0,如:

git-tfs version 0.17.2.0 (TFS client library 11.0.0.0 (MS)) (64-bit)

【讨论】:

  • 您可以通过设置环境变量强制 git-tfs 使用特定版本的 tfs 程序集(参见 github.com/git-tfs/git-tfs/blob/…)(但这需要安装此版本的 Visual Studio。跨度>
  • 我设法在集合名称中使用“DefaultCollection”迁移所有历史记录(而不是我可以在 DevOps 项目中读取的名称): git tfs clone -u {email-account} -p {personal-account -password} https://{devops-username}.visualstudio.com/DefaultCollection $/{folder-name}/ 。 --branches=none
猜你喜欢
  • 2019-07-13
  • 2015-05-27
  • 2014-01-12
  • 1970-01-01
  • 2017-02-07
  • 1970-01-01
  • 2020-02-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多