如何永久禁用 Visual Studio 2013 中的 Git 集成?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21150060/
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-10 17:35:49  来源:igfitidea点击:

How can you disable Git integration in Visual Studio 2013 permanently?

gitvisual-studio-2013

提问by Bryan Porter

I know that you can disable git integration by using the Tools / Options dialog, but what I've noticed is that this setting doesn't seem to persist across sessions; i.e., as soon as close and reopen the solution, Git integration is enabled again. I'm guessing Visual Studio is seeing the .git folder in my solution file system tree.

我知道您可以使用“工具/选项”对话框禁用 git 集成,但我注意到此设置似乎不会跨会话持续存在;即,一旦关闭并重新打开解决方案,就会再次启用 Git 集成。我猜 Visual Studio 在我的解决方案文件系统树中看到了 .git 文件夹。

There are a variety of Visual Studio 2013 plugins that behave incorrectly when the Git plug-in is enabled, I prefer to manage my source control at the command line, and I work on a few very large projects for which the Git integration introduces noticeable slowdowns in opening and working with the solution. I'd like to turn it off for good, as I simply don't use it or need it. Is this possible?

有多种 Visual Studio 2013 插件在启用 Git 插件时行为不正确,我更喜欢在命令行管理我的源代码管理,并且我正在处理一些非常大的项目,其中 Git 集成引入了明显的减速在打开和使用解决方案时。我想永远关闭它,因为我根本不使用它或不需要它。这可能吗?

回答by Aebsubis

As you said you can disable the source control plugin going to:

正如您所说,您可以禁用源代码控制插件:

  • Tools / Options
  • Check "Show all settings"
  • Source Control / Plug-in Selection
  • Set "Current source control plug-in" to "None"
  • 工具/选项
  • 勾选“显示所有设置”
  • 源代码管理/插件选择
  • 将“当前源代码控制插件”设置为“无”

Then, as Ade Miller says: Restart Visual Studio.

然后,正如 Ade Miller 所说:重新启动 Visual Studio。

My Visual Studio was working really slow since the git plugging was enabled and I managed to disable it "persistently across sessions" following this steps.

由于启用了 git 插件,我的 Visual Studio 工作速度非常慢,我设法按照以下步骤“跨会话持续”禁用它。

Hope it helps.

希望能帮助到你。

回答by Artalus

I had the same problem with Visual Studio 2015, where NoGit extension wasn't even allowed to install. I use the "open last solution on start-up" option so I thought that maybe this was somehow connected to the problem.

我在 Visual Studio 2015 中遇到了同样的问题,甚至不允许安装 NoGit 扩展。我使用“启动时打开最后一个解决方案”选项,所以我认为这可能与问题有关。

So I simply closed my solutionbefore going to "Tools - Options - Source Control", thenturned it off, restarted VS and - voila, SC stayed turned off! Hope it stays so in other solutions as well.

所以我在进入“工具 - 选项 - 源代码控制”之前简单地关闭了我的解决方案然后将其关闭,重新启动 VS 并且 - 瞧,SC 保持关闭状态!希望在其他解决方案中也是如此。

回答by Alex

For me, creating the repository with the following command fix the problem:

对我来说,使用以下命令创建存储库可以解决问题:

git init --separate-git-dir _git

Since it doesn't create a .gitdirectory, only a .gitfilepointing to the real repository directory, e.g.:

因为它不创建一个.git目录,只有一个.git文件指向真实的版本库目录,例如:

gitdir: C:/tfs/ProjectName/Main/_git

Visual Studio (at least up to VS2015 Update 3, which is what I use) doesn't notice it!

Visual Studio(至少到 VS2015 Update 3,这是我使用的)没有注意到它!

This worked better than the environment variable stuff because Git Extensions (that I'm using) had problem supporting that, but dealt with the .gitfile pointing to a _gitfolder perfectly.

这比环境变量的东西更有效,因为 Git 扩展(我正在使用)有问题支持它,但完美地处理了.git指向_git文件夹的文件。

回答by John Brett

One reason for the git SCC being re-enabled in VS2015 every time the IDE loads is CodeLens. Tools/Options/Text Editor/All Languages/CodeLens There's a checkbox for various activities involving TFVS and Git - having any of those git checkboxes checked will automatically enable the Git plugin if it thinks you're working on a git repo.

每次 IDE 加载时都会在 VS2015 中重新启用 git SCC 的原因之一是 CodeLens。工具/选项/文本编辑器/所有语言/CodeLens 有一个用于涉及 TFVS 和 Git 的各种活动的复选框 - 如果它认为您正在处理 git 存储库,选中任何这些 git 复选框将自动启用 Git 插件。

回答by mxmissile

NoGit Visual Studio extensionhandles this behavior.

NoGit Visual Studio 扩展处理此行为。

Bonus: awesome description.

奖励:很棒的描述。

回答by Ed Andersen

For Visual Studio 2015, I found that CodeLens was re-enabling the Git Source Control plugin after restarting. Disabling CodeLens fixed this.

对于 Visual Studio 2015,我发现 CodeLens 在重新启动后重新启用 Git 源代码控制插件。禁用 CodeLens 解决了这个问题。

回答by hlovdal

(Update: This answer now provides a fully working solution based my deeper understanding of GIT_DIR and GIT_WORK_TREE)

(更新:这个答案现在提供了一个完整的解决方案,基于我对 GIT_DIR 和 GIT_WORK_TREE 的更深入理解)

Summary: Git is flexible enough that you are able to move the .gitdirectory to a place outside the work directory with the files checked out from tfs. This makes it then possible to have a 100% clean tfs checkout without any traces of git that visual studio is able to detect while still being able to operate it as a git repositiory. The key is to separate the git dir (git repository storage) and the work tree (your checked out source code).

简介: Git 足够灵活,您可以将.git目录移动到工作目录之外的位置,并从 tfs 中检出文件。这使得 100% 干净的 tfs 结帐成为可能,而没有任何 git 痕迹,visual studio 能够检测到,同时仍然能够将其作为 git 存储库进行操作。关键是将 git dir(git 存储库存储)和工作树(您签出的源代码)分开。

Say that your source code is checked out in c:\work\someproject\tfscodeand you already have run git initthere, e.g. visual studio detects the c:\work\someproject\tfscode\.gitdirectory and that causes trouble.

假设您的源代码已签入c:\work\someproject\tfscode并且您已经在git init那里运行,例如,visual studio 检测到c:\work\someproject\tfscode\.git目录并导致问题。

To make life more plessant do the following:

为了让生活更愉快,请执行以下操作:

$ cd /cygdrive/c/work/someproject
$ mv tfscode/.git tfscode.git
$ echo export GIT_DIR=/cygdrive/c/work/someproject/tfscode.git >> env.sh
$ echo export GIT_WORK_TREE=/cygdrive/c/work/someproject/tfscode >> env.sh
$ source env.sh
$ cd tfscode
$ git status
...
$

This works perfectly with regards to visual studio since it then is completely ignorant of anything stored in git.

这对于 Visual Studio 来说非常有效,因为它完全不知道 git 中存储的任何内容。

回答by sb.olofsson

This worked for me in Visual Studio 2013 and 2015. Persists even though you close and re-open Visual Studio.

这在 Visual Studio 2013 和 2015 中对我有用。即使您关闭并重新打开 Visual Studio,它仍然存在。

  1. Open the solution

  2. Go to Tools -> Options -> Source Control -> Set plugin to None

  3. Close Visual Studio and execute the command below with administrative rights.

  1. 打开解决方案

  2. 转到工具 -> 选项 -> 源代码管理 -> 将插件设置为无

  3. 关闭 Visual Studio 并使用管理权限执行以下命令。

move "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Microsoft.TeamFoundation.Git.Provider.dll" "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Microsoft.TeamFoundation.Git.Provider.dll.bak"

回答by Maks

Remove the Microsoft GitProvider from Visual Studio 2015

从 Visual Studio 2015 中删除 Microsoft GitProvider

Link: http://researchaholic.com/2015/02/02/remove-the-microsoft-gitprovider-from-visual-studio-2013/

链接:http: //researchaholic.com/2015/02/02/remove-the-microsoft-gitprovider-from-visual-studio-2013/

  1. Make sure Visual Studio is closed
  2. Open regedit
  3. Navigate to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0_Config\SourceControlProviders
  4. Delete 11b8e6d7-c08b-4385-b321-321078cdd1f8 In the details pane it should say GitProvider
  5. Open Visual Studio
  1. 确保 Visual Studio 已关闭
  2. 打开注册表
  3. 导航到 HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0_Config\SourceControlProviders
  4. 删除 11b8e6d7-c08b-4385-b321-321078cdd1f8 在详细信息窗格中,它应该说 GitProvider
  5. 打开 Visual Studio

回答by Boklucius

I managed to disable the built-in Visual Studio Git Provider by deleting all occurrences of those registry keys:

我设法通过删除所有出现的这些注册表项来禁用内置的 Visual Studio Git 提供程序:

7FE30A77-37F9-4CF2-83DD-96B207028E1B

7FE30A77-37F9-4CF2-83DD-96B207028E1B

11b8e6d7-c08b-4385-b321-321078cdd1f8

11b8e6d7-c08b-4385-b321-321078cdd1f8