119

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.

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?

hlovdal
  • 26,565
  • 10
  • 94
  • 165
Bryan Porter
  • 1,585
  • 2
  • 10
  • 18
  • 1
    possibly useful: To fix it, I disabled the extension and then changed the source control using the Change Source Control command ‘Bind’ function - See more at: http://www.thereprogram.com/2013/04/18/visual-studio-tools-for-git/#sthash.rEzBZSMo.dpuf – Tom Kerr Jan 16 '14 at 05:12
  • 1
    That's the trick - in Visual Studio 2013, Git integration isn't provided as an extension, it's baked right in. Can't disable the extension, as there is no extension to disable. Boo! – Bryan Porter Jan 16 '14 at 17:20
  • maybe you could automate it? – klumsy Jan 17 '14 at 09:40
  • I could, but what trigger would I use to execute the automation? An extension that fires on load? Writing an extension to disable an OOB feature feels weird. – Bryan Porter Jan 17 '14 at 14:29
  • 1
    My team had this issue too. I think the trick we used was to load a solution, disable git integration and then restart VS. You might also try installing SP 1. – Ade Miller Feb 22 '14 at 18:15
  • I also spend about an hour using regmon to see if I could find a registry key to disable this feature but to no avail. – Ade Miller Apr 21 '14 at 15:00
  • Wouldn't it be "better" to pester the developers of said extensions to fix their code? If a plugin behave incorrectly due to the base system, it's the plugin's fault IMHO. – rubenvb Oct 13 '14 at 14:12
  • Good luck getting Microsoft to fix this, I suspect :( (it is the "Microsoft" git source control plugin, after all) – aikeru Oct 23 '14 at 14:44
  • See new answer, it's easy with currently unpublished NoGit release: http://stackoverflow.com/a/33789257/2284031 – Ben Wilde Nov 18 '15 at 20:02
  • I'm pleased to report that in 2017 (release candidate at least) the option DOES NOT re-enable itself. This is a godsend as the git plugin still hurts performance. In the task manager, you can see Git For Windows going absolutely crazy and using lots of RAM and CPU constantly, even when idle. I'm working on a medium (35ish projects ~ 9000 files) solution, and it is seriously impacting IDE performance to the point the IDE is unusable. The support for git inside VS is basic at best (let's face it, Git isn't really for Windows) - and as I only use it to commit, I prefer to use the command line! – user3791372 Feb 17 '17 at 06:53
  • Visual Studio 2015 > Tools > Options > Source Control > Plug-in Selection > Current source control pug-in: > None – Martin Jun 27 '18 at 13:48

20 Answers20

96

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.

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.

Hope it helps.

Aebsubis
  • 1,921
  • 18
  • 19
  • 45
    I find that VS simply re-enables GIT on re-opening the solution. Also, the NoGit extension mentioned below doesn't work. Hmm. – mackenir Jul 24 '15 at 14:34
  • I have the same problem. VS simply re-enables the GIT integration on VS restart. Note that I've disabled it as described above dozens of times now. (it keeps coming back) – Venryx Mar 26 '16 at 23:09
  • 1
    it re-enables it for me too. apparently someone wrote a extension that disables it on start. crazy! http://stackoverflow.com/questions/22459959/how-do-you-remove-microsoft-git-provider. another hack in this link is to remove permission from Everyone for provider dll: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Microsoft.TeamFoundation.Git.Provider.dll – Sonic Soul Jun 12 '16 at 15:39
  • 3
    I found that opening the Team Explorer window re-enabled it for me. So I just closed that window and turned the option back to None. Hopefully VS won't try to "help" me again on this one. – Sean Jul 22 '16 at 22:10
  • With no solutions loaded, I changed the source control plugin setting from Git back to None. I then restarted Visual Studio (still w/o a solution) and checked the setting, and it was now Visual Studio Team Foundation Server. I set it back to None again and restarted VS again, and this time it seems to have stuck. – Adrian McCarthy Dec 23 '16 at 16:34
  • setting worked perfectly in Visual Studio Ultimate 2013. Solutions/Projects now open in a fraction of the time. Thank you! – mike Jan 26 '17 at 20:40
  • I tried selecting TFS instead of GIT... That doesn't work. Select None. I also deleted the .GIT hidden folder and the .gitignore and .gitattribute hidden files too. When I restarted VS it automatically selected TFS in the Tools>Options>SourceControl settings. – D. Kermott Aug 07 '18 at 19:03
54

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.

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

Artalus
  • 1,114
  • 12
  • 25
  • 2
    A thousand times this. No registry hack, no custom extension, this works. Thanks ! – driis Aug 31 '15 at 19:39
  • 1
    I had to combine this with one other thing: I updated my VisualStudio start menu shortcut to include this command line flag: `/ResetSettings "C:\Users\myuserid\Documents\Visual Studio 2015\Settings\CurrentSettings.vssettings"`. According to the command line reference, this setting "Restores the IDE's default settings, optionally resets to the specified VSSettings file." That seems to ensure that my desired settings get applied always. – mcw Sep 08 '15 at 16:07
  • 4
    Thanks! This worked for me. Another note - be sure to close the Team Viewer tab on the right side (next to Solution Explorer) before you do this, or it will automatically re-enable itself if you click it. – ForOhFor Feb 03 '16 at 19:02
  • 2
    Make sure you kill the run away devenv.exe process that lingers around after VS crashes leaving at least one of your CPU's pinned, otherwise you can do this over and over and it won't stick. But so happy when it does and no registry hack required! – Atters Mar 27 '16 at 04:08
  • Doesn't this also kill the TFS integration? That is, I thought the original goal was to turn off _only_ git. What did I miss here? – ruffin Sep 18 '20 at 15:14
  • This works great for me using the latest version of VS2019, thanks! – classicSchmosby98 Jul 10 '21 at 13:09
21

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

git init --separate-git-dir _git

Since it doesn't create a .git directory, only a .git file pointing to the real repository directory, e.g.:

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

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

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

KurzedMetal
  • 12,540
  • 6
  • 39
  • 65
Alex
  • 356
  • 2
  • 5
  • Agreed, I would rather not mess with the environment variable stuff either. This works nicely. – kaveman Dec 03 '14 at 19:10
  • I will add that there is a slight typo above, the option is `--separate-git-dir` – kaveman Dec 03 '14 at 19:14
  • 2
    Awesome workaround! Thanks god VS2013 didn't implement reading the this `.git` "filesystem-agnostic Git symbolic link to the repository", or we would've found in the same problem. – KurzedMetal Aug 11 '15 at 19:36
  • 2
    This is indeed the simplest solution existing in the whole chain of answers. – Tarik Sep 21 '16 at 16:18
  • 1
    Thanks a lot for the hint! Since `NoGit' Visual Studio extension doesn't work with VS 2017 this is the only way for me to stop VS 2017 from "git-monitoring" :-) Thanks! – Ruslan Garipov Aug 25 '17 at 07:19
  • @KurzedMetal They f*&%ing did it (in VS 2017) :( – Marc.2377 Dec 14 '18 at 19:32
  • 1
    @Marc.2377 did they add support for to detect `.git` **file** too in VS2017? that's going to be bad news for me in a short future (when I get a notebook and VS upgrade). I'm still using VS2015 so far and this worked for me perfectly so far. – KurzedMetal Dec 20 '18 at 14:38
  • @KurzedMetal yes, they most unfortunately did. I wrote a short batch script to aid in my daily usage; it renames the .git file (or folder) to .git_BKP and back. I can post it as an answer to this question when I get home. – Marc.2377 Dec 20 '18 at 17:30
15

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.

John Brett
  • 149
  • 1
  • 4
  • Working (for me) answer that doesn't suggest removing the solution from source control or damaging the VS install. – Evren Kuzucuoglu Jun 14 '17 at 09:54
  • 1
    This is the rigth solution. – Juan Pablo Califano Jul 11 '17 at 12:28
  • This is really important as I saw Visual Studio 2017 overrides the trivial thing of disabling source control. But it seems that even after that VS 2017 creates a `.vs` folder. – Royi Oct 11 '17 at 10:47
  • 1
    This appears to be the most straight forward, permanent, clean solution offered - this should be the accepted answer, and it also works in VS 2019 – T.S Feb 02 '21 at 08:54
  • To make this a complete solution, you might include the second step of actually disabling the Git plugin once CodeLens is disabled. – bugged87 Jun 23 '21 at 15:33
10

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

Ed Andersen
  • 1,158
  • 1
  • 11
  • 14
8

NoGit Visual Studio extension handles this behavior.

Bonus: awesome description.

mxmissile
  • 11,464
  • 3
  • 53
  • 79
8

This worked for me in Visual Studio 2013 and 2015. Persists even though you close and re-open 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.

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"
sb.olofsson
  • 899
  • 9
  • 14
7

It was pain on back for a week and I didn't know how did I start this source control service in VS2015. But got to know how to stop it. Here is the steps to decouple git/any source control with VS2019.

Go to VS-->Tools-->Options-->Source Control-->[Current Source Control Plug-in]

You get all the possible source control in your system and None option. If you choose None you are all set. Mine got fixed just after selecting None option , hit ok and restart the VS and no more source control.

SRoy
  • 987
  • 2
  • 8
  • 10
6

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

Summary: Git is flexible enough that you are able to move the .git directory 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).

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

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.

hlovdal
  • 26,565
  • 10
  • 94
  • 165
6

Remove the Microsoft GitProvider from Visual Studio 2015

Link: 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
Maks
  • 2,808
  • 4
  • 30
  • 31
  • 1
    improvement of this answer - apply the following reg file Windows Registry Editor Version 5.00 [-HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0_Config\SourceControlProviders\{11b8e6d7-c08b-4385-b321-321078cdd1f8}] – Ivan Shakhov May 13 '16 at 13:35
4

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

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

11b8e6d7-c08b-4385-b321-321078cdd1f8

Boklucius
  • 1,896
  • 17
  • 19
  • 1
    This works for me! Thanks! But one question remains: If eventually I'll update VS (doing minor or major update), will I have to delete the keys again? – Ruslan Garipov Jan 21 '16 at 05:24
4

Use new NoGit extension package: https://github.com/markrendle/nogit/releases/download/1.0.5/NoGit.vsix

Download and add to visual studio: https://superuser.com/questions/73675/how-do-i-install-a-vsix-file-in-visual-studio

Easy.

Community
  • 1
  • 1
Ben Wilde
  • 5,552
  • 2
  • 39
  • 36
  • To install, I preferred manually changing .vsix extension to .zip, so you can then right click and extract files. Then all you have to do is put the new extracted folder into your users app data folder (%appdata%\Local\Microsoft\VisualStudio\{version}\Extensions). Then restart visual studio, open Tools->Extensions and Updates..., then find "NoGit" and enable it, then restart again. – Ben Wilde Nov 18 '15 at 20:04
  • [Bad news for VS2019](https://marketplace.visualstudio.com/items?itemName=MarkRendle.NoGit&ssr=false#review-details): "_I'm very sorry, but I've tried to get it working on VS2019 and it actually closes the solution._" This answer also looks like a dupe of [this one](https://stackoverflow.com/a/27109438/1028230)? – ruffin May 11 '21 at 13:38
3

I'm also having problems with Git in Visual Studio but I think I finally have found a working solution. Until now I have used the trick of renaming the .git folder to _git and adding a textfile named .git containing the line "gitdir: _git". But since upgrading to VS2019 that doesn't work anymore.

I have tried lots of different solutions, but none have worked since I need Git for some projects and not for others. My problem project is using my company's Team Foundation Server for source control. But since I've lost code in bad merges made by TFS, I'm committing my changes to a local Git repo before updating or committing to TFS.

D:\Projects\TFS\.git Local git repo that VS shouldn't use.

D:\Projects\TFS\ProjectA\$tf TFS files that VS should use for ProjectA.

No matter how I tried, I could not get VS to use TFS for ProjectA when it found a .git folder in a parent folder. My solution is to move the .git folder to:

D:\Projects\TFS-GIT\.git

and create a directory junction to the ProjectA folder. Start an elevated command prompt and run:

mklink /J D:\Projects\TFS-GIT\ProjectA D:\Projects\TFS\ProjectA

Opening the D:\Projects\TFS\ProjectA\ProjectA.sln in Visual Studio, it won't find any .git folder and will connect to TFS like it should.

Running git commands from D:\Projects\TFS-GIT will use the same files as Visual Studio except that the .git folder is also available. TortoiseGit also works fine from this folder.

Anlo
  • 3,228
  • 4
  • 26
  • 33
2

You need to close all VS solutions. start one, set Menu\tools\options\Source Control\Git-->None, close this solution when prompted. Now, when opening any other solution, the options stays "None".

1

VS2015 was sucking up 50% of my CPU when idle. I learned that disabling Git was the solution. Unfortunately disabling Git only to learn it automatically re-enables it.

In my case I actually wanted to use Git but not with 50% cpu usage.

As NoGit solution is only available for VS2013, you can instead download: Git Source Control Provider even if you don't use Git. My CPU usage is now 2,2% instead of 50% when idle.

bluee
  • 997
  • 8
  • 18
0

I had a hard time finding a solution for this, and made it after so many attempts, so I can't be precise. Create another local repository using GitHub Desktop in another folder. Done this, open Visual Studio without loading a project, now Team Explorer should show up both repositories. Select the new repository as you should do some operations, at this pont you can "remove" your old repository, since the new one is the "active" one. After doing this, I removed the .hidden .git* files from the former folder. Now opening the project does not cause the old repository to be re-created again. Hope this helps.

Stefano Losi
  • 719
  • 7
  • 18
0

This git extension hell slows up everything in IDE (VS 2015 in my case). I had to remove the entire TeamFoundation folder to get rid of this. The downside is that you will not be able to use Git and TeamFoundation in Visual Studio 2015. Note: Backup this folder elsewhere and restore it when needed.

To delete the folder i did this. The steps i followed to delete the right folder

The reason i did this is because , VS 2015 generates random folder name for the TeamFoundation extension, so my folder name could be different than yours.

Soundararajan
  • 2,000
  • 21
  • 23
-2

Tools, Options, Source Control, Plug-in Selection, None

Dale Fraser
  • 4,623
  • 7
  • 39
  • 76
  • 8
    Visual Studio 2013 will not persist this change. The next time you open the solution it will automatically re-select the Git plugin if it detects a .git directory. It will even do this if the solution is already bound to TFVC. – Mark W Dickson Jul 29 '14 at 18:03
-5

1) close solution and visual studio. 2) go to solution's directory and delete hidden git directory and 2 git text files. 3) open visual studio again. 4) goto tools -> options and source control. 5) select none. 6) restart visual studio. 7) open your solution. 8) goto tools -> options and source control again and select TFS. 9) in solution right click to select add source control to solution. 10) select tfs.

  • 1
    They don't want TFS and they certainly DONT WANT to delete .git folder as it will erase whole local commit history. What they ask for is how to prevent VS from using information from .git folder, not how to purge that folder. – quetzalcoatl Apr 12 '18 at 09:37
-6

Set Tools\Options\Source Control back to TFS. Close Visual Studio 2015. Open the root folder of your source code. Delete folder named ".git". Restart.

  • 5
    That kinda sounds like your asking the op to remove the folder from git completely. "I prefer to manage my source control at the command line" seems to indicate that wouldn't be the solution for him. – Evren Kuzucuoglu Jun 14 '17 at 09:43