简体   繁体   English

结合 Git Bash 并在 CMDER 的当前文件夹中打开

[英]Combine Git Bash and opening in current folder in CMDER

Please describe me, who have such experience, how to correctly set the options of CMDER to open new console with Git Bash in current folder(Open CMDER here, for example).请有这种经验的我描述一下如何正确设置CMDER的选项以在当前文件夹中使用Git Bash打开新控制台(例如在此处打开CMDER)。 This string does not work:此字符串不起作用:

"C:\Program Files (x86)\Git\bin\sh.exe" --login -i -new_console:%__CD__%

I tried mix to this我试过混合这个

""C:\Program Files (x86)\Git\bin\sh.exe" --login -i"

and this和这个

cmd /k "%ConEmuDir%\..\init.bat" -new_console:%__CD__%

Your second option should have worked:您的第二个选项应该有效:

See this gist (also for Cmder ):请参阅此要点(也适用于Cmder ):

  • Open Conemu打开 Conemu
  • Open Settings -> Tasks or go to new tab button -> Setup tasks .打开Settings -> Tasks或转到 new tab button -> Setup tasks
  • Click + to add a new task单击 + 添加新任务
  • Enter the name as Git Bash or whatever you like输入名称为 Git Bash 或任何您喜欢的名称

Task parameters:任务参数:

/icon "C:\Program Files (x86)\Git\etc\git.ico" /dir "C:\_git"

Command:命令:

"C:\Program Files (x86)\Git\bin\sh.exe" --login -i 

If you want to force your $HOME directory to be on local HD not network drive, you can do this as the command instead:如果您想强制您的$HOME目录位于本地 HD 而非网络驱动器上,您可以使用以下命令执行此操作:

"set PATH=C:\Users\<username>;%PATH%" & "set HOME=C:\Users\Ndecarteret" & "C:\Program Files (x86)\Git\bin\sh.exe" --login -i 

This tutorial is quite complete too .教程也很完整

Note: your case could be related to issue 709 .注意:您的案例可能与问题 709相关。

Use this script (set it as shortcut for example)使用此脚本(例如将其设置为快捷方式)

%windir%\system32\wscript.exe "C:\Program Files (x86)\Git\Git Bash.vbs" "PATH"

You simply have to use the Git Bash.vbs and pass it a path parameter to the desired folder.您只需使用Git Bash.vbs并将其传递给所需文件夹的路径参数。 This is how the git bash here context menu works.这就是git bash here上下文菜单的工作方式。 pass $1 as the folder parameter.将 $1 作为文件夹参数传递。


--login

The --login command-line option passed to bash make it behave as a "login shell"传递给 bash 的--login命令行选项使其表现为“登录外壳”

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

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