Here's instructions to add a "Open with Git Bash" option to your context menu using the Git Bash that comes with GitHub for Windows.
Here's the registry script to add the option in. Because the installation paths for GitHub for Windows varies from user to user, I will go over which lines to change so that this script works for you.
Copy this script into your favorite text editor.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\directory\shell\git_bash]
@="Open with Git Ba&sh"
; optional: set "Icon" key to change the icon of the option
[HKEY_CLASSES_ROOT\directory\shell\git_bash\command]
@="\"C:\\WINDOWS\\SysWOW64\\wscript.exe\" \"C:\\Users\\<username>\\AppData\\Local\\GitHub\\PortableGit_<guid>\\Git Bash.vbs\" \"%1\""
The line under [HKEY_CLASSES_ROOT\directory\shell\git_bash]
sets the text of the option that will show in your context menu.
Feel free to change the text between the quotations. The &
tells Windows that the next character is the shortcut key for it.
The line under [HKEY_CLASSES_ROOT\directory\shell\git_bash\command]
sets the command that the option will run.
Before changing this line, note that the command needs to be surrounded by double quotes, and all slashes and double quotes inside need to be escaped with \\
.
The three parts of the command are:
- the full path to
wscript.exe
. - the full path to PortableGit's
git.exe
that GitHub For Windows installs. (ex.AppData/Local/GitHub/PortableGit_<guid>/bin/git.exe
) "%1"
, which will be replaced with the path to the folder you right-clicked on when the command runs.
In my case, the resulting command that you want to run is:
C:\WINDOWS\SysWOW64\\wscript.exe C:\Users\<username>\AppData\Local\GitHub\PortableGit_<guid>\Git Bash.vbs "%1"
Now you have to surround it in quotes and escape all the slashes and double quotes to copy it into the script:
@="\"C:\\WINDOWS\\SysWOW64\\wscript.exe\" \"C:\\Users\\<username>\\AppData\\Local\\GitHub\\PortableGit_<guid>\\Git Bash.vbs\" \"%1\""
- Run GitHub for Windows.
- While GitHub for Windows is running, open the Task Manager (ctrl+shift+esc)
- Find
GitHub.exe
underDetails
, right click it, and clickOpen file location
. - Shift+right-click
GitHub.exe
in the explorer, and clickCopy as Path
. - In the registry script, under
@="Open with Git Ba&sh"
, add a new line.
Type "Icon"=
and paste the path you copied. Be sure to close it in double quotes and escape all the slashes.
My example:
"Icon"="C:\\Users\\<username>\\AppData\\Local\\Apps\\2.0\\45TL3GP7.TQE\\WT1D0ML9.C6O\\gith..tion_317444273a93ac29_0002.000d_6a9b565322d28a14\\GitHub.exe"
After that is all done, save the script (as a .reg
) and run it.
If you want to remove this option from context menu at any time, run this script.
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\directory\shell\git_bash]