【问题标题】:How does visual studio 2013 remember the mapping between a remote git/tfs repository and a local path?Visual Studio 2013 如何记住远程 git/tfs 存储库和本地路径之间的映射?
【发布时间】:2014-07-03 13:06:53
【问题描述】:

Visual Studio 如何记住给定团队项目中的哪个 GIT/TFS(Git over TFS)存储库已克隆到本地计算机?

在团队项目中浏览 git 存储库时,Visual Studio 会在尚未克隆的存储库右侧显示一个图标。

在本地计算机上克隆存储库后,此图标会消失。从此时起,Visual Studio 将映射 (remote repository, local path) 保存在某处。

  • 这些映射保存在哪里?
  • 是否有 API 公开/访问这些信息?

【问题讨论】:

    标签: git tfs visual-studio-2013


    【解决方案1】:

    详细说明 -- 到目前为止

    文件%APPDATA%\Microsoft\VisualStudio\12.0\Team Explorer\GitTeamProjects.config 似乎包含此信息。

    <?xml version="1.0" encoding="utf-8"?>
    <!--This file caches information about Git team projects.-->
    <collection_list>
      <collection guid="9737cdde-596c-43f5-bea7-eadbe664f536" collectionUri="http://tfs:8080/tfs/tahaa" />
      <collection guid="d3ee7565-1499-4a84-9eb3-7e97bf3a932e" collectionUri="http://tfs:8080/tfs/test2013">
        <project name="_TestBuilds" projectUri="vstfs:///Classification/TeamProject/2706587b-a4b3-4404-a5b1-0e8f210eddc5">
          <repository name="SetupConfigurator" guid="54ff434a-bced-4457-8b7c-7f2ab2577514" LastActiveClone="K:\TFS\SetupConfigurator" />
          <repository name="Trunk" guid="a08927d7-4e0a-4035-ae5d-964bf03926a4" LastActiveClone="K:\_TestBuilds" />
          <repository name="IntegrationTests" guid="37286658-9138-4bab-bc93-9eeb67addd36" LastActiveRepo="Yes" LastActiveClone="K:\GitRepositories\IntegrationTests" />
        </project>
      </collection>
    </collection_list>
    

    我修改过一次,然后 Visual Studio 似乎丢失了映射。

    但是,将其还原为原始内容后,Visual Studio 似乎不再使用它。

    我还找到了存储在注册表中的存储库列表(HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\TeamFoundation\GitSourceControl\Repositories)。

    Repositories
       hash
         Name(REG-SZ)
         Path(REG-SZ)
       hash
         Name(REG-SZ)
         Path(REG-SZ)
       ...
    

    Visual Studio 2015

    文件名略有变化: %APPDATA%\Microsoft\VisualStudio\14.0\Team Explorer\TeamExplorer.config

    注册表路径已演变为HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\TeamFoundation\GitSourceControl\Repositories

    如何刷新 Visual Studio 映射

    假设您的所有 git 存储库都位于本地计算机上的同一文件夹中,并且该文件夹的路径是 K:\GitRepositories

    1. 打开 Visual Studio 2015
    2. 打开团队资源管理器
    3. 按下插头图标
    4. 在“本地 Git 存储库”部分中,单击按钮添加
    5. 在文本框中输入“K:\GitRepositories”,然后输入“Add”

    完成!您的映射已更新。

    【讨论】:

    • +1 我有一个 prod TFS 服务器和一个测试 TFS 服务器,我需要将相同的 git repo 映射到两者。我找到了 GitTeamProjects.config 文件,但什么也没做。找到这篇文章后,我看到了注册表项并且能够修复它。很棒的发现,感谢您的发帖!
    • 我需要更改本地存储库的存储位置,但在 VS2013 中找不到任何位置来更改它。在您指定的位置更改注册表中的设置效果很好,谢谢!
    猜你喜欢
    • 2015-03-25
    • 1970-01-01
    • 2012-08-09
    • 2018-06-15
    • 1970-01-01
    • 2014-08-21
    • 2018-12-24
    • 2014-10-19
    相关资源
    最近更新 更多