30

I have a little question, how can I remove the "git bash here" and "git gui here" from my menu context in my Documents directory?

I have tried:

  1. Reinstalling the Git-2.15.0-64-bit with unchecked options
  2. Removing the keys from:

`

[-HKEY_CLASSES_ROOT\Directory\background\shell\git_gui]

[-HKEY_CLASSES_ROOT\Directory\background\shell\git_shell]

[-HKEY_CLASSES_ROOT\Directory\Shell\git_gui]

[-HKEY_CLASSES_ROOT\Directory\Shell\git_shell]

`

i didnt have the git_gui and git_shell in HKEY_LOCAL_MACHINE

Removing the keys gave me a good result -> Git isn't appearing in most of my directories but it still appears in my Documents (the place where i have all my projects from netbeans to android studio).

Did someone have a similar problem? Could someone help?

4 Answers4

30

I Think I've found other reference about it. I've delete mine on

HKEY_CLASSES_ROOT\LibraryFolder\background\shell

Based on https://stackoverflow.com/a/32490883/4906348, Quite simple, I never think about it. You should see like this.

The Git Bash here on Library Background

From This Before Registry delete

To This. It works. After Registry Delete

Note
For Windows 10, there may be also keys in HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell and/or HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\git_shell which you may have to delete as well.

Morse
  • 5,778
  • 5
  • 31
  • 55
Benyamin Limanto
  • 455
  • 8
  • 16
  • 6
    Thanks. Regarding the current version (2.16.2.windows.1 on Win10 x64), there are also keys (Bash and possibly GUI) within HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell that would need removed, as well. – clicheName Mar 17 '18 at 06:13
  • Yep that's true, I think that search function in regedit isn't working properly until it miss thing like this man! – Benyamin Limanto Mar 17 '18 at 10:37
  • And this is the answer I was looking for! Thanks! – Dawid Dave Kosiński May 13 '18 at 14:17
  • 1
    I found `git_shell` and `git_gui` here too: `Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\git_shell` – Anthony Mar 13 '19 at 02:21
21

You need to delete these keys:

HKEY_CLASSES_ROOT\Directory\shell\git_gui

HKEY_CLASSES_ROOT\Directory\shell\git_shell

HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_gui

HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_shell

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_gui

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_shell

This works with Windows 10.1803 and Git 2.25.0 (YMMV with other Windows/Git versions).

Virendra
  • 253
  • 2
  • 4
  • Thx, works for me, without `HKEY_CLASSES_ROOT\LibraryFolder\background\shell\` he is not exists. – Nikolay Sergeevich Jun 09 '20 at 13:18
  • Also `HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\background\shell\git_gui` and `HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\background\shell\git_shell` (for me). – CrazyIvan1974 Aug 17 '20 at 20:20
9

You can run this using PowerShell to simplify things and automate. Since you must remove keys from HKLM, it must run with elevated privileges. Use "#Requires -RunAsAdministrator" if you want to save it in a PS1 script.

#Requires -RunAsAdministrator
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT -ErrorAction SilentlyContinue

$path = "HKLM:\SOFTWARE\Classes\Directory\background\shell\git*
HKLM:\SOFTWARE\Classes\Directory\shell\git*
HKLM:\SOFTWARE\Classes\LibraryFolder\background\shell\git*
HKCR:\Directory\Background\shell\git*
HKCR:\Directory\shell\git*
HKCR:\LibraryFolder\background\shell\git*" -split '\n'

Remove-Item -Confirm:$false -Recurse -Path $path
PollusB
  • 1,347
  • 1
  • 18
  • 26
  • This worked like a charm, just what I needed. I use 'choco install git.install' for windows 'auto-install' script. This can cleanup the unwanted stuff after install. – arberg May 22 '20 at 15:10
  • 5
    TRY CHOCO install git.install --params "/NoShellIntegration" It will install it the way you want. – PollusB May 25 '20 at 03:48
  • 1
    OH, I didn't know choco could have custom package arguments. Thank you, it worked beautifully: `choco install git.install --params /NoShellIntegration` – arberg May 26 '20 at 07:19
  • Unfortunately the powershell script didn't do anything for me :-/ but thanks for the tipp @PollusB, this worked perfectly! – skjerns Sep 16 '20 at 07:59
  • @skjerns. Did you ran the script with elevated console (Runas Admin) ? – PollusB Oct 29 '20 at 19:11
  • 1
    @arberg The only problem with CHOCO is: It doesn't remember the arguments when you upgrade GIT. Even when you enable [x] useRememberedArgumentsForUpgrades. So my script still make sense after an upgrade. – PollusB Oct 29 '20 at 19:12
0

First, you need to cleanup the unwanted context menu entries in the registry, as described in "How to Clean Up Your Messy Windows Context Menu".
Typically in:

HKEY_CLASSES_ROOT\Directory\shell
HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers

Then you need to make sure you install Git for Windows with the Portable self-extracting archive: PortableGit-2.15.0-64-bit.7z.exe.
Once extracted in any folder you want, you can add said folder to your %PATH%, and you will be able to use Git without any extra contextual menu entry anywhere.

VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • Thanks for your answer, but I want to remove git from my computer, the context menu is cleared only in some cases, in the Documents folder it still exists. Did you have a problem like this? – Dawid Dave Kosiński Nov 06 '17 at 12:40
  • @DawidDaveKosiński No and the link I provide should get rid of the entry in Document as well. Plus I only uncompress the Portable version, so I never get to see any contextual menu. – VonC Nov 06 '17 at 12:42
  • i'ill try the link later because at the moment I'm not on my computer. – Dawid Dave Kosiński Nov 06 '17 at 13:23