如何添加一个上下文(又名右键单击)菜单到windows资源管理器,当单击时,在当前资源管理器文件夹中打开git-bash控制台?


当前回答

通常这里的git bash只能在目录上运行,所以你必须上一个目录,右键单击前一个目录,然后在这里选择git bash(当然在Windows操作系统上)。 注意:目录内的上下文菜单没有git bash here选项。

其他回答

在添加“使用Ruby启动命令提示符”到上下文菜单时也有类似的问题,因为它涉及到将参数与cmd补丁一起传递。遵循与上面解决方案类似的过程

Windows Registry Editor Version 5.00 

[HKEY_CLASSES_ROOT\*\shell\Cmd With Ruby]  
@="Cmd With Ruby"  
"Icon"="C:\\Windows\\System32\\cmd.exe"

[HKEY_CLASSES_ROOT\*\shell\Cmd With Ruby\command]
@="\"C:\\Windows\\System32\\cmd.exe\" \"/E:ON /K
\"C:\\Ruby25-x64\\bin\\setrbvars.cmd\"\" \"--cd=%1\"\""


[HKEY_CLASSES_ROOT\Directory\shell\bash]  
@="Cmd With Ruby"  
"Icon"="C:\\Windows\\System32\\cmd.exe"


[HKEY_CLASSES_ROOT\Directory\shell\bash\command]
@="\"C:\\Windows\\System32\\cmd.exe\" \"/E:ON /K
\"C:\\Ruby25-x64\\bin\\setrbvars.cmd\"\" \"--cd=%1\"\"" 

[HKEY_CLASSES_ROOT\Directory\Background\shell\bash]  
@="Cmd With Ruby"  
"Icon"="C:\\Windows\\System32\\cmd.exe"


[HKEY_CLASSES_ROOT\Directory\Background\shell\bash\command]
@="\"C:\\Windows\\System32\\cmd.exe\" \"/E:ON /K
\"C:\\Ruby25-x64\\bin\\setrbvars.cmd\"\" \"--cd=%v.\"\""

将gitpath添加到Environment-path变量(例如C:\Program Files\Git\ cmd),通过该变量,您可以使用命令行从任何文件夹访问git。

我在一台新的Windows 10 Pro公司笔记本电脑上安装git -2.38.1-64位时遇到了这个问题。

我尝试了几种方法……并考虑了一个regedit脚本(道德上相当于“护士-电锯!”)…但是通过简单地卸载和重新安装Git(作为“Admin”)解决了这个问题。

具体地说:

Control Panel > Programs/Features > Uninstall Git Reboot Windows Reinstall Git-2.38.1-64-bit as "Admin" Carefull check all the options, especially: "Windows Explorer Integration: Git Bash Here, Git GUI Here <= These are checked by default ... and I'm sure they were both "Y" on the initial install I copied my .gitconfig ("C:\Users\USERNAME.gitconfig") from another PC <= I don't believe this was "essential" ...but I thought I'd mention it... Browse to a local Git repo and verify the Git context menus work <= Success after reinstall!

你可以安装TortoiseGit为Windows和包括集成在上下文菜单。 我认为它是在Windows上使用Git的最佳工具。

对我有用的几乎是这个,但有以下REGEDIT路径: HKEY_LOCAL_MACHINE/SOFTWARE/Classes/Directory/background/shell,在这里我创建了密钥Bash,值是我想要显示的名称,然后在这个命名命令下创建了另一个密钥,值作为git-bash.exe的路径

我在Windows 10上安装了一个新的git,由于某种原因没有自动添加这个(git版本2.12.0 64bit)