Combine Git Bash and opening in current folder in CMDER

允我心安 提交于 2021-02-18 08:32:06

问题


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). 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__%

回答1:


Your second option should have worked:

See this gist (also for Cmder):

  • Open Conemu
  • Open Settings -> Tasks or go to new tab button -> Setup tasks.
  • Click + to add a new task
  • Enter the name as Git Bash or whatever you like

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:

"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.




回答2:


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. This is how the git bash here context menu works. pass $1 as the folder parameter.


--login

The --login command-line option passed to bash make it behave as a "login shell"



来源:https://stackoverflow.com/questions/36675254/combine-git-bash-and-opening-in-current-folder-in-cmder

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!