contextmenu - How to add a "open git-bash here..." context menu to the windows explorer?

ID : 20186

viewed : 28

Tags : gitcontextmenuwindows-explorerwindows-shell-extension-menugit

Top 5 Answer for contextmenu - How to add a "open git-bash here..." context menu to the windows explorer?

vote vote

98

Step 1. On your desktop right click "New"->"Text Document" with name OpenGitBash.reg

Step 2. Right click the file and choose "Edit"

Step 3. Copy-paste the code below, save and close the file

Step 4. Execute the file by double clicking it

Note: You need administrator permission to write to the registry.

Windows Registry Editor Version 5.00 ; Open files ; Default Git-Bash Location C:\Program Files\Git\git-bash.exe  [HKEY_CLASSES_ROOT\*\shell\Open Git Bash] @="Open Git Bash" "Icon"="C:\\Program Files\\Git\\git-bash.exe"  [HKEY_CLASSES_ROOT\*\shell\Open Git Bash\command] @="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%1\""  ; This will make it appear when you right click ON a folder ; The "Icon" line can be removed if you don't want the icon to appear  [HKEY_CLASSES_ROOT\Directory\shell\bash] @="Open Git Bash" "Icon"="C:\\Program Files\\Git\\git-bash.exe"   [HKEY_CLASSES_ROOT\Directory\shell\bash\command] @="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%1\""  ; This will make it appear when you right click INSIDE a folder ; The "Icon" line can be removed if you don't want the icon to appear  [HKEY_CLASSES_ROOT\Directory\Background\shell\bash] @="Open Git Bash" "Icon"="C:\\Program Files\\Git\\git-bash.exe"  [HKEY_CLASSES_ROOT\Directory\Background\shell\bash\command] @="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%v.\"" 

And here is your result :

enter image description here

vote vote

87

I had a similar issue and I did this.

Step 1 : Type "regedit" in start menu

Step 2 : Run the registry editor

Step 3 : Navigate to HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\Background\shell. If you don't have the shell key, create one.

Step 4 : Right-click on "shell" and choose New > Key. name the Key "Bash"

Right click on "shell" and choose New > Key. name the Key "Bash"

Step 5 : Modify the value and set it to "open in Bash" This is the text that appears in the right click.

enter image description here

enter image description here

Step 6 : Create a new key under Bash and name it "command". Set the value of this key to your git-bash.exe path.

enter image description here

enter image description here

enter image description here

Close the registry editor.

You should now be able to see the option in right click menu in explorer

PS Git Bash by default picks up the current directory.

EDIT : If you want a one click approach, check Ozesh's solution below

vote vote

78

The easiest way is to install the latest Git from here. And while installing, make sure you are enabling the option Windows Explorer Integration.

enter image description here

Once you are done, you will get those options in whenever you right click on any folder.

enter image description here

Hope it helps.

vote vote

69

Here are the Registry exports (*.reg files) for Git GUI and Git Bash directly from the Windows installer —Git GUI:

Windows Registry Editor Version 5.00  [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_gui] @="Git &GUI Here" "Icon"="C:\\Program Files\\Git\\cmd\\git-gui.exe"  [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_gui\command] @="\"C:\\Program Files\\Git\\cmd\\git-gui.exe\" \"--working-dir\" \"%v.\"" 

Git bash:

Windows Registry Editor Version 5.00  [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_shell] @="Git Ba&sh Here" "Icon"="C:\\Program Files\\Git\\git-bash.exe"  [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\git_shell\command] @="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%v.\"" 

For detail about *.reg files, see “How to add, modify, or delete registry subkeys and values by using a .reg file” from Microsoft.

vote vote

54

You can install git for windows or Github for windows , both give you the choice while installing to add this feature to your windows explorer. You can find it here:

Github for Windows

https://windows.github.com/

Git for Windows

http://git-scm.com/

Top 3 video Explaining contextmenu - How to add a "open git-bash here..." context menu to the windows explorer?

Related QUESTION?