Dawid Dave Kosiński
Dawid Dave Kosiński

Reputation: 901

How to remove git from menu context in Documents?

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 didn't 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).

Does anyone have a similar problem? Could someone help?

Upvotes: 50

Views: 47500

Answers (9)

KamWebDev
KamWebDev

Reputation: 377

You can run cmd as administrator and execute:

REG DELETE HKEY_CLASSES_ROOT\Directory\shell\git_gui /f
REG DELETE HKEY_CLASSES_ROOT\Directory\shell\git_shell /f
REG DELETE HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_gui /f
REG DELETE HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_shell /f
REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_gui /f
REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_shell /f

Upvotes: 0

cijic
cijic

Reputation: 1

Top answers are good enough, but I recommend do not edit register manually. It's better to use specific app for enabling/disabling shell menu items - ShellMenuView by Nirsoft: ShellMenuView with selected Git &GUI Here and Git Bash Here

Upvotes: 0

Ananta Raha
Ananta Raha

Reputation: 1071

It's been a bit late, however someone might find it useful. I didn't have to mess around with the Registry editor or something. What worked for me is just:

  1. Uninstall git normally (from the Settings>Apps or Control Panel).
  2. Restart PC and install git again.
  3. During installation, uncheck "Windows explorer integrations".

I'm using git version 2.38.1 on windows 10.

Upvotes: 1

li key
li key

Reputation: 1

Depending on Windows version you have those folders in your registry:

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

Go to each folder and create new String Value with name LegacyDisable that would resolve an issue immediately. If you want to revert changes, just delete that string.

Here is the picture with the details: LegacyDisable

Upvotes: 0

BromTeque
BromTeque

Reputation: 31

I personally prefer a non-destructive approach to solving issue, as that makes it a lot easier to reverse. Here’s one such approach:

  • Open regedit.exe
  • Find the key
    HKEY_CLASSES_ROOT\Directory\shell\git_shell
    
  • Add a new DWORD (32-bit Value) named HideBasedOnVelocityId
  • Assign it a value of 006698a6 (hex)

Should look something like this

Repeat the process for:

  • HKEY_CLASSES_ROOT\Directory\shell\git_gui
    
  • HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_shell
    
  • HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_gui
    
  • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_shell
    
  • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_gui
    

And it should be gone from the context menu everywhere.

Upvotes: 3

PollusB
PollusB

Reputation: 1826

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

Upvotes: 22

Virendra
Virendra

Reputation: 851

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).

Upvotes: 52

Benyamin Limanto
Benyamin Limanto

Reputation: 851

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.

Upvotes: 62

VonC
VonC

Reputation: 1328122

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.

Upvotes: 1

Related Questions