右键单击时"Git Bash here"无效

Fox*_*llD 17 right-click git-bash

我不知道发生了怎么回事,但在今天之前,我可以右键点击任何文件夹,这将是一个选项Git Bash here.但今天我没有这个选择.任何人都知道怎么回来?

小智 22

如何修复而不重新安装:

将所有程序从主硬盘驱动器移出并粘贴到我的"P"驱动器后,我遇到了这个问题.但保持所有目录结构相同.

Git从:
C:\ DEV\PROG\GIT
TO:
P:\ DEV\PROG\GIT

1:打开注册表编辑器: 在开始菜单搜索中键入"regedit",然后按Enter键.

2:找到"git bash here"的上下文菜单快捷方式配置在regedit中:菜单"编辑">"查找">"查找内容"并输入"git_shell"

3:编辑数据值,使路径指向正确的位置.在我的情况下,我改变了:

"C:\DEV\PROG\GIT\git-bash.exe" "--cd=%v."
TO:
"P:\DEV\PROG\GIT\git-bash.exe" "--cd=%v."
Screen shot included below.
Run Code Online (Sandbox Code Playgroud)

git_shell RegEdit中的数据路径


And*_*w T 18

重新安装Git并选择:

Context menu entries: "Git Bash Here" (and the "Git GUI Here" option)
Run Code Online (Sandbox Code Playgroud)

在安装过程中.不能说为什么它消失了,但这应该把它带回来.


Fun*_*hor 7

如果无法使用重新安装方法,请执行步骤。

使用REGEDIT

1/ Open regedit (search it if needed)
2/ Go to 'HKEY_CURRENT_USER/Software/Classes/Directory/Background'
3/ Create new key 'shell'
4/ Create new key 'Git bash here' (or whatever name you want to see in the menu)
5/ Create new key 'command' (must be named command)

At this point point you'll have
'HKEY_CURRENT_USER/Software/Directory/Background/shell/Git bash here/command'

6/ Edit the value of the command key as follow 'pathToGit/git-bash.exe'
Run Code Online (Sandbox Code Playgroud)

更新或打开新的Windows资源管理器,右键单击即可看到。

总结一下的图片: 如何在上下文菜单中在此处添加git bash

  • 如果您像我一样并且喜欢查看图标,则可以执行此操作。将此值添加到“Git bash here”键中。新建 -> 字符串值 -> 名称 = 图标 -> 数据 = C:\Program Files\Git\git-bash.exe (4认同)
  • 将 --cd=%v 添加到命令中将根据上下文选择您正在运行此命令的当前目录。我将这个答案与下面保罗的答案结合起来。 (2认同)

小智 5

运行此脚本(AddGitToExplorerContextMenu.reg)。您可能需要更新 Git 的位置。您也可以通过 regedit 手动添加

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell]
@="Git Bash"

[HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell\command]
@="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%v.\""
Run Code Online (Sandbox Code Playgroud)


小智 5

遇到了同样的问题,意识到以前右键单击任意位置或文件夹内的选项会显示,但现在我必须选择或突出显示该文件夹,然后右键单击才能显示选项。