如何添加一个上下文(又名右键单击)菜单到windows资源管理器,当单击时,在当前资源管理器文件夹中打开git-bash控制台?
当前回答
你可以为windows安装git或为windows安装Github,两者都让你在安装时选择将此功能添加到windows资源管理器中。你可以在这里找到它:
Github for Windows
https://windows.github.com/
Git for Windows
http://git-scm.com/
其他回答
我也有类似的问题,我这样做了。
第一步:在开始菜单中输入“regedit”
步骤2:运行注册表编辑器
步骤3:导航到HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\Background\shell。如果您没有shell密钥,请创建一个。
第四步:右键单击“shell”,选择“New > Key”。命名键“Bash”
第五步:修改值并将其设置为“open in Bash”这是在右键单击中出现的文本。
步骤6:在Bash下创建一个新密钥,命名为command。将该键的值设置为git-bash.exe路径。
关闭注册表编辑器。
你现在应该可以在资源管理器的右键菜单中看到这个选项
PS Git Bash默认选择当前目录。
编辑:如果你想要一个点击的方法,检查下面的Ozesh的解决方案
在添加“使用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.\"\""
我在一台新的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!
@Shaswat Rungta说:“我认为问题更多的是如何在安装结束后添加它。”
在我的PC(Windows 7)上,我认为在安装Visual Studio 2017后,“Git Bash here”命令消失了。
我通过下载并重新安装Git来解决这个问题。 注意:“安装Git for Windows时,默认情况下上下文菜单选项不是‘开启’的。你必须在安装过程中选择它们。”——@nbushnell (我这样做了)
你可以为windows安装git或为windows安装Github,两者都让你在安装时选择将此功能添加到windows资源管理器中。你可以在这里找到它:
Github for Windows
https://windows.github.com/
Git for Windows
http://git-scm.com/
推荐文章
- 为什么调用git分支——unset-upstream来修复?
- Windows git“警告:LF将被CRLF取代”,这是警告尾巴向后吗?
- git中的哈希冲突
- git可以自动在空格和制表符之间切换吗?
- Git暂存文件列表
- 如何将git配置存储为存储库的一部分?
- 如何修改GitHub拉请求?
- 如何在Github和本地删除最后n次提交?
- 我如何调试git/git-shell相关的问题?
- 错误:无法使用rebase进行拉取:您有未分阶段的更改
- Git隐藏未缓存:如何把所有未分期的变化?
- 真实的恶魔
- 如何从另一个分支获得更改
- Git:权限被拒绝(publickey)致命-无法从远程存储库读取。克隆Git存储库时
- git reflog和log有什么区别?