简体   繁体   English

如何自定义msysgit的shell扩展的“此处Git Bash”命令所使用的终端?

[英]How to customize which terminal is used by the “Git Bash Here” command of msysgit's shell extension?

默认的cmd.exe很糟糕,我想使用“ Console”外壳。

The registry key used to launch that cmd.exe is: 用于启动该cmd.exe的注册表项为:

HKEY_CLASSES_ROOT\Directory\shell\git_shell\command

It contains (on my Windows7 installation): 它包含(在我的Windows7安装上):

"C:\Windows\SysWOW64\cmd.exe" /c "pushd "%1" && "C:\Prog\Git\1.6.5.1\bin\sh.exe" --login -i"

So you could change that entry by any other console you want. 因此,您可以通过所需的任何其他控制台更改该条目。

I am using Git-1.7.6-preview20110708 我正在使用Git-1.7.6-preview20110708

You can edit the Git Bash.vbs file located in C:\\Program Files\\Git: 您可以编辑位于C:\\ Program Files \\ Git中的Git Bash.vbs文件:

Here is my full Git Bash.vbs file 这是我完整的Git Bash.vbs文件

Option Explicit

Dim shell : Set shell = CreateObject("WScript.Shell")
Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
Dim gitdir : gitdir = Left(WScript.ScriptFullName,InStrRev(WScript.ScriptFullName,"\"))
Dim bash : bash = fso.BuildPath(gitdir, "bin\sh.exe")
Dim temp : temp = fso.GetSpecialFolder(2) ' Temporary folder
Dim linkfile : linkfile = fso.BuildPath(temp, fso.GetTempName() & ".lnk")

Dim link : Set link = shell.CreateShortCut(linkfile)
link.TargetPath = bash
link.Arguments = "--login -i"
link.WindowStyle = 1
If WScript.Arguments.Length > 0 Then link.WorkingDirectory = WScript.Arguments(0)
link.Save

Dim app : Set app = CreateObject("Shell.Application")
If WScript.Arguments.Length=1 Then
    app.ShellExecute "C:\Program Files\Console2\Console.exe", " -t ""Git Bash"" -d """ & WScript.Arguments(0) & """"
Else
    app.ShellExecute "C:\Program Files\Console2\Console.exe", " -t ""Git Bash"""
End If

Im sorry to say that if you are using git-cheetah this seems to be impossible for now. 很遗憾地说,如果您正在使用git-cheetah ,目前看来这是不可能的。 I found this question while looking for an answer so I thought I would put the results of my findings here. 我在寻找答案时发现了这个问题,所以我想将研究结果放在这里。

git-cheetah looks up the the registry key HKEY_CURRENT_USER\\Software\\Git-Cheetah\\PathToMsys and executes sh from that path. git-cheetah查找注册表项HKEY_CURRENT_USER\\Software\\Git-Cheetah\\PathToMsys然后从该路径执行sh

If you want to use ConEmu as your terminal there is no need to change the registry. 如果要使用ConEmu作为终端,则无需更改注册表。 You can configure it all from within ConEmu as described here 您可以按照此处所述从ConEmu中进行全部配置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM