bash 如何从文档的菜单上下文中删除 git?

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

How to remove git from menu context in Documents?

gitbashshellregistryright-click

提问by Dawid Dave Kosiński

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?

我有一个小问题,如何从我的 Documents 目录的菜单上下文中删除“git bash here”和“git gui here”?

I have tried:

我试过了:

  1. Reinstalling the Git-2.15.0-64-bit with unchecked options
  2. Removing the keys from:
  1. 使用未选中的选项重新安装 Git-2.15.0-64 位
  2. 从以下位置删除密钥:

`

`

[-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

我在 HKEY_LOCAL_MACHINE 中没有 git_gui 和 git_shell

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

删除密钥给了我一个很好的结果 - > Git 没有出现在我的大多数目录中,但它仍然出现在我的文档中(我拥有从 netbeans 到 android studio 的所有项目的地方)。

Did someone have a similar problem? Could someone help?

有人有类似的问题吗?有人可以帮忙吗?

采纳答案by Benyamin Limanto

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.

基于https://stackoverflow.com/a/32490883/4906348,很简单,我从来没有想过。你应该这样看。

The Git Bash here on Library Background

库背景中的 Git Bash

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\shelland/or HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\git_shellwhich you may have to delete as well.

注意
对于 Windows 10,可能还有一些键HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell和/或HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\git_shell您可能还需要删除。

回答by Virendra

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

这适用于 Windows 10.1803 和 Git 2.25.0(YMMV 与其他 Windows/Git 版本)。

回答by PollusB

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.

您可以使用 PowerShell 运行它以简化事情并实现自动化。由于您必须从 HKLM 中删除密钥,因此它必须以提升的权限运行。如果要将其保存在 PS1 脚本中,请使用“#Requires -RunAsAdministrator”。

#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

回答by VonC

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:

首先,您需要清除注册表中不需要的上下文菜单条目,如“如何清理凌乱的 Windows 上下文菜单”中所述。
通常在:

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

Then you need to make sure you install Git for Windowswith 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.

然后,您需要确保使用便携式自解压存档安装适用于 Windows 的 GitPortableGit-2.15.0-64-bit.7z.exe.
一旦解压到您想要的任何文件夹中,您就可以将所述文件夹添加到您的%PATH%.