CMD Command for "Git Bash Here"

bash, git, windows

Solution

How do I check what command is bound to "Git Bash Here"?

Open the Registry Editor using `regedt32` or `regedit`.

Menu "Edit" > "Find" > "Find what" and enter "git_shell"

Examine the returned Registry entries.

One will be:

HKEY_CLASSES_ROOT\Directory\shell\git_shell\command

With the value:

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

where `git_install_dir` is the directory where you have installed `git`.

You can see it runs something similar to the following command:

pushd "%1" && "C:\git_install_dir\bin\sh.exe" --login -i

Problem

In Windows I can run "Git Bash Here" in the current directory by opening right click menu. I want to place gitbashhere.bat in default path for commands to have got easy access from standard cmd window. The `sh.exe --login -i` command only opens git bash in sh.exe's directory instead of the current directory. How do I check what command is bound to "Git Bash Here"?

Original source