前言

在使用 TortoiseGit 作为Git的可视化工具,但是会经常用到命令行操作,一般来说,安装了TortoiseGit后,右键会出现 open git-bash here... 的命令。但是,可能由于某些原因,这个右键菜单选项不见了。下面就是重新添加此右键菜单的方法。

步骤、

第一步:在桌面新建文本文件,然后重命名为OpenGitBash.reg

右键菜单添加 Open Git Bash-LMLPHP

第二步:编辑文件,复制下面的内容,并保存

Windows Registry Editor Version 5.00
; Open files
; Default Git-Bash Location C:\Program Files\Git\git-bash.exe

[HKEY_CLASSES_ROOT\*\shell\Open Git Bash]
@="Open Git Bash"
"Icon"="C:\\Program Files\\Git\\git-bash.exe"

[HKEY_CLASSES_ROOT\*\shell\Open Git Bash\command]
@="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%1\""

; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear

[HKEY_CLASSES_ROOT\Directory\shell\bash]
@="Open Git Bash"
"Icon"="C:\\Program Files\\Git\\git-bash.exe"


[HKEY_CLASSES_ROOT\Directory\shell\bash\command]
@="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%1\""

; This will make it appear when you right click INSIDE a folder
; The "Icon" line can be removed if you don't want the icon to appear

[HKEY_CLASSES_ROOT\Directory\Background\shell\bash]
@="Open Git Bash"
"Icon"="C:\\Program Files\\Git\\git-bash.exe"

[HKEY_CLASSES_ROOT\Directory\Background\shell\bash\command]
@="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%v.\""

第三步:双击执行 OpenGitBash.reg

弹框1:点击是
右键菜单添加 Open Git Bash-LMLPHP
弹窗2:点击确定
右键菜单添加 Open Git Bash-LMLPHP

第四步:打开右键菜单,查看效果

右键菜单添加 Open Git Bash-LMLPHP

09-27 00:22