How to add a context (aka right click) menu to the windows explorer that, when clicked, opens the git-bash console in the current explorer folder?
-
If you install current version of Git for Windows, it already provides those shortcuts. – Lombas Jan 11 '19 at 17:25
-
3@Lombas not if you're using portable, which you might have to use if you don't have admin rights. – PixelMaster Jun 27 '19 at 09:50
-
6If your contextual items disappeared after a Windows update you can just run the script here: https://github.com/Hattoff/GitBashHere – Francois Carstens Sep 18 '20 at 12:28
-
Currently not supported in Windows 11. – Vaggelis Manousakis Mar 05 '22 at 08:16
-
There's a post created for Windows 11, can track that availability there: https://stackoverflow.com/questions/70237709/how-to-add-a-git-bash-here-context-menu-option-to-the-windows-explorer-in-wind – David Oganov Mar 24 '22 at 13:13
-
1The easiest way is to install git once again from https://git-scm.com/download/win – Ziaullhaq Savanur May 23 '22 at 08:45
20 Answers
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 :

- 9,724
- 11
- 63
- 92

- 6,536
- 1
- 25
- 23
-
Awesome. Works on windows 7. Just be careful to make sure that the installation directory of git is the same as mentioned in the file. – Deepak Shajan Jul 17 '17 at 07:05
-
2
-
8@ZexDC : If you want a 'Open Git Bash here' instead of 'Open Git Bash' , you can simply add a 'here' in the OpenGitBash.reg where ever you encounter 'Open Git Bash' . – Ozesh Oct 28 '17 at 04:08
-
2FYI, if you want it only for a specific user account, the this is where the Git for Windows installer puts those git_bash and git_gui keys: `HKEY_USERS\{the-account-SID}\Software\Classes\Directory\Background\shell` , `HKEY_USERS\{the-account-SID}\Software\Classes\Directory\shell` , and `HKEY_USERS\{the-account-SID}\Software\Classes\LibraryFolder\background\shell` – Granger Jan 04 '18 at 19:18
-
4Worked Right Away in Windows 10. Thanks! Awesome solution. – Gabriel Amazonas Mesquita Mar 28 '18 at 13:44
-
Worked perfectly. Note that since I logged in as a standard user, I had to first open the regedit app as admin, and them import this .reg file there. – API Oct 11 '19 at 09:32
-
Nice. A set of reg specs that work for me as the current user is: Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Classes\Directory\shell] [HKEY_CURRENT_USER\Software\Classes\Directory\shell\git_gui] @="Git &GUI Here" "Icon"="C:\\Program Files\\Git\\cmd\\git-gui.exe" – ElderDelp Nov 16 '19 at 21:41
-
and [HKEY_CURRENT_USER\Software\Classes\Directory\shell\git_gui\command] @="\"C:\\Program Files\\Git\\cmd\\git-gui.exe\" \"--working-dir\" \"%1\"" [HKEY_CURRENT_USER\Software\Classes\Directory\shell\git_shell] @="Git Ba&sh Here" "Icon"="C:\\Program Files\\Git\\git-bash.exe" [HKEY_CURRENT_USER\Software\Classes\Directory\shell\git_shell\command] @="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%1\"" – ElderDelp Nov 16 '19 at 21:43
-
-
@vipin8169 yes infact you can do this for any installed application by just providing a proper path to the executable. – Ozesh Oct 08 '20 at 10:42
-
5In case anyone wants to add a keyboard shortcut for this command (The underline thingy in the context menu) just add an `&` in front of the key you want. For eg.: `Open Git &bash here` would make this command accessible by the keyboard shortcut letter `b` whenever you open context menu. – squareRoot17 Nov 21 '20 at 07:00
-
1Creating the reg file this way kept on producing `OpenGitBash.reg.txt` on my machine. If this happens, go into file explorer and click view->File name extensions. You can then edit the `txt` portion of the filename out. – lawrence-witt Mar 30 '21 at 21:01
-
Awesome explanation and trick but unfortunately doesn't work in Windows 11. – Vaggelis Manousakis Mar 05 '22 at 08:13
-
-
if you want to get this in a file. here it is https://cdn.amuslim.org/shell-scripts/OpenGitBash.reg – MindRoasterMir Aug 29 '22 at 10:34
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"
Step 5 : Modify the value and set it to "open in Bash" This is the text that appears in the right click.
Step 6 : Create a new key under Bash and name it "command". Set the value of this key to your git-bash.exe path.
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

- 9,534
- 3
- 19
- 43

- 3,635
- 2
- 19
- 26
-
4I was getting an error Explorer error. To fix this I have to add an Expandable String Value in the commandKey with values "C:\Program Files\Git\git-bash.exe" "%V" – Bimzee Nov 29 '16 at 06:59
-
12this also worked in windows10 while I only had the shellex key and no shell (which I created per your directions and all worked fine) – Harrison Mar 21 '17 at 11:16
-
-
1@Julix http://stackoverflow.com/a/27090678/2697556 Found this. Hope it works for you – Shaswat Rungta Apr 15 '17 at 04:33
-
12Windows 10 here: while this solution worked for me by adding a "shell" first, it doesn't give you a visual cue to see the shortcut easily. I like Ozesh's [solution](https://stackoverflow.com/a/44019893/466314) more because it gives you an icon as well. It's literally copy-paste and run. It will save you a lot more time. Both solutions work though. – Ultimater Sep 11 '17 at 23:02
-
-
1I personally prefer this solution because I don't want to have multiple entries in the context menu by some chance, and also I want to make sure the paths of the installation are right. To find the path for installation, if a gitbash is running, go to Task Manager, right click on it, and use Open File Location (or Details). – msanjay Oct 30 '18 at 06:34
-
8Just a quick addition to this...if you want to add the icon, in the Bash key add a new string value called `Icon` and set it's value to `C:\Program Files\Git\mingw64\share\git\git-for-windows.ico` – Tara Dec 05 '19 at 17:57
-
This procedure failed me, while the one below did the trick splendidly by creating *OpenGitBash.reg* file. – s3c Jul 16 '20 at 15:05
-
1For some reason, If you wanna add git icon to it also, then do these steps -> 1. In the "bash" name reg you just created right click and create a new "Expandable String Value" --screen shot image link-- https://ibb.co/5rLKZGf 2. Name it as icon and then double click it. 3. Goto your Git installation directory and find the git icon file with .ico extension (For me, it was here Git\mingw64\share\git\git-for-windows.ico) 5. Paste icon file's path to "icon" value and done! – Back2Lobby Aug 11 '20 at 07:35
-
1Totally works for me. I had shellex dir, then just create shell and the steps above. – Xelian Nov 20 '20 at 18:45
-
is possible to add a first git command, for example "git status"? – Andrea Scarafoni Feb 23 '21 at 22:18
-
what if i wish to see this option only when I hold shift? (like you can see "Open PowersShell window here" only when holding shift) – Eliav Louski Jun 29 '21 at 15:10
-
here is link to a reg file that will do it for you. just run it and get it. https://cdn.amuslim.org/shell-scripts/OpenGitBash.reg – MindRoasterMir Aug 29 '22 at 10:34
The easiest way is to install the latest Git from here. And while installing, make sure you are enabling the option Windows Explorer Integration.
Once you are done, you will get those options in whenever you right click on any folder.
Hope it helps.

- 18,755
- 12
- 103
- 140
-
14Unfortunately those are only install options, they not available after installation – ThomasRones Mar 04 '20 at 13:41
-
1@ThomasRones, yeah, it's irritating that running the installer again doesn't give me access to these options. – Skewjo Nov 17 '20 at 13:47
-
10Thank you very much! Works perfectly! IMPORTANT NOTE FOR THIS ANSWER: It's very important to uncheck the "Only show new options" option located at the very bottom of the first installation window (in order to get to this "Select components" section)! – Vasilije Bursac Apr 08 '21 at 17:07
-
1For me, re-running the installer did work. I first ran the installer without un-checking that box mentioned by Vasilije Bursac ("Only show new options"). Then just ran the installer again, unchecked the box, and now I have the git context menu items back. I am at 2.31.1 – jNorris Apr 15 '21 at 13:12
-
run it and get it. https://cdn.amuslim.org/shell-scripts/OpenGitBash.reg – MindRoasterMir Aug 29 '22 at 10:34
-
This should be the accepted answer because even though some other answers work, they don't show the Git icons and other Git options. – Arsen Khachaturyan Feb 18 '23 at 09:08
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.

- 5,288
- 2
- 45
- 60
-
-
2@TheSETJ The letter that succeeds `&` becomes the hotkey for that menu entry. – mono blaine Mar 23 '18 at 08:09
-
it works with less code. Be sure to replace the path with the real path. – youkaichao Sep 19 '18 at 10:16
-
I think this is the best answer for those who are looking a way to re-add the options after the installation. Works perfectly fine as well! – Satch Feb 25 '23 at 08:12
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
Git for Windows

- 854
- 6
- 17
-
9This might be a useful answer, but it's important to note that this is emphatically *not* "Git for Windows". You can get official builds of Git for Windows [from the Git website](http://git-scm.com/) or from the [Git for Windows site](http://msysgit.github.io/). Your link goes to *GitHub* for Windows, which is a proprietary tool separate from Git. – ChrisGPT was on strike Jun 24 '14 at 13:09
-
1When installing Git for Windows the context menu options are not 'on' by default. You will have to select them during the install. – nbushnell Oct 27 '15 at 14:11
-
5I think the question is more about how to add it after the installation is over. – Shaswat Rungta Aug 28 '16 at 18:22
What worked for me was almost this, but with the following REGEDIT path:
HKEY_LOCAL_MACHINE/SOFTWARE/Classes/Directory/background/shell
and here I created the key Bash, with the value of what I want the display name to be, and then created another key under this named command with the value as the path to git-bash.exe
I'm on Windows 10 and have a fresh git install that didn't add this automatically for some reason (git version 2.12.0 64bit)

- 398,270
- 210
- 566
- 880

- 71
- 1
- 1
-
2You should adapt the entire answer here, so that a reader doesn't have to go find that post first (which may have been deleted, the user deleted, or the user renamed). – Nathan Tuggy Mar 16 '17 at 00:15
As, @Shaswat Rungta said: "I think the question is more about how to add it after the installation is over."
On my PC(Windows 7) I think that the command "Git Bash here" disappeard after I installed Visual Studio 2017.
I fixt this by downloading and installing Git again.
NOTE: "When installing Git for Windows the context menu options are not 'on' by default. You will have to select them during the install." – @nbushnell (I did this)

- 2,303
- 4
- 27
- 48
-
Regarding your NOTE. Which particular option did you select during install to enable the context menu options? For me, it doesn't show the option to "Git CMD here" – squashed.bugaboo Jan 09 '18 at 22:03
-
Pay attention to the installation process steps. My current version had these settings added by default. – Marian07 Jan 10 '18 at 09:30
-
I did. To be clear there is no option to "Git CMD here" in the installation steps, which is what I was looking for. They only have it for "Git GUI" and "Git Bash". Which explains why there is no contex menu option for "Git CMD here". Wonder why? Right now I have to launch it manually, which makes no sense. – squashed.bugaboo Jan 10 '18 at 17:13
-
`Git Bash` is what you are looking for. That opens the `terminal` in the current directory. – Marian07 Jan 10 '18 at 20:28
-
Then why do they have the Git CMD option after installation? Why even show it up in the Start menu? Besides, on Windows it makes more sense to have the Git CMD instead of Git Bash. – squashed.bugaboo Jan 12 '18 at 05:33
Had a similar issue in adding "Start Command Prompt with Ruby" to context menu as it involves passing parameters along with the patch of cmd. Followed a similar procedure as the solution above
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Cmd With Ruby]
@="Cmd With Ruby"
"Icon"="C:\\Windows\\System32\\cmd.exe"
[HKEY_CLASSES_ROOT\*\shell\Cmd With Ruby\command]
@="\"C:\\Windows\\System32\\cmd.exe\" \"/E:ON /K
\"C:\\Ruby25-x64\\bin\\setrbvars.cmd\"\" \"--cd=%1\"\""
[HKEY_CLASSES_ROOT\Directory\shell\bash]
@="Cmd With Ruby"
"Icon"="C:\\Windows\\System32\\cmd.exe"
[HKEY_CLASSES_ROOT\Directory\shell\bash\command]
@="\"C:\\Windows\\System32\\cmd.exe\" \"/E:ON /K
\"C:\\Ruby25-x64\\bin\\setrbvars.cmd\"\" \"--cd=%1\"\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\bash]
@="Cmd With Ruby"
"Icon"="C:\\Windows\\System32\\cmd.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\bash\command]
@="\"C:\\Windows\\System32\\cmd.exe\" \"/E:ON /K
\"C:\\Ruby25-x64\\bin\\setrbvars.cmd\"\" \"--cd=%v.\"\""

- 3,988
- 9
- 25
- 38

- 61
- 7
When you install git-scm found in "https://git-scm.com/downloads" uncheck the "Only show new options" located at the very bottom of the installation window
Make sure you check
- Windows Explorer integration
- Git Bash Here
- Git GUI Here
Click Next and you're good to go!

- 69
- 5
Usually git bash here
can be run only on directories so you have to go up a directory and right click on the previous directory then select git bash here
(of course on Windows OS).
Note: context menu inside a directory does not have a git bash here
option.

- 133
- 1
- 9
-
You can right click in the white space while inside of a directory to access git bash here. – RyanJMcGowan Jul 24 '16 at 19:39
-
@RyanJMcGowan you are right. However in windows XP that option is not available so I asumed that was the case. – qt-x Aug 22 '16 at 10:44
-
This helped me as I'm using Directory Opus as a Explorer replacement. I only get the context menu items when right clicking a folder (not in the empty white space). Works fine both ways when using Windows Explorer. – AtliB Jul 13 '17 at 16:40
Another option but using PowerShell script.
This is basically a PowerShell script which does almost the same as this answer (it also adds icon).
Create file (addOpenGitBashHereContextMenu.ps1
), paste in the code below and run it from PowerShell.
You probably need to change exePath
to point to your git
executable.
Also change contextMenuText
if you want to change the text in context menu.
$exePath = $env:USERPROFILE + '\scoop\apps\git\current\git-bash.exe'
$contextMenuText = 'Open Git Bash Here'
$regEntryName = 'git_shell'
$regPathShell = 'HKCU:\SOFTWARE\Classes\Directory\Background\shell'
$regPathContextMenu = $regPathShell + '\' + $regEntryName
$regPathCommand = $regPathContextMenu + '\command'
$user = $env:UserName
echo "Setting '$contextMenuText' context menu..."
echo " User name: '$user'"
echo " Register path: '$regPathCommand'"
echo " Executable path: '$exePath'"
# Key: shell
If (-NOT (Test-Path $regPathShell)) {
New-Item -Path $regPathShell
}
# Key: regEntryName
If (-NOT (Test-Path $regPathContextMenu)) {
New-Item -Path $regPathContextMenu -Value $contextMenuText
# Add Icon to context menu
Set-ItemProperty -Path $regPathContextMenu -Name 'Icon' -Value $exePath
}
# Key: command
If (-NOT (Test-Path $regPathCommand)) {
New-Item -Path $regPathCommand -Value $exePath
}

- 13
- 2
Try updating your git. For window user you can update your git via cmd by simply writing the command- "git update-git-for-windows".
When done, you can simply right click inside a directory where you want to open the gitbash and check if its showing "Gitbash here" or not. If it's not showing anything, try to look for "Show more options" there and click on it. Now, you may able to see it.

- 9
- 3
I ran into this problem installing Git-2.38.1-64-bit on a new Windows 10 Pro corporate laptop.
I tried several things ... and considered one of the regedit scripts (the moral equivalent of "Nurse - chainsaw!")... but resolved the problem by simply uninstalling and reinstalling Git (as "Admin").
Specifically:
Control Panel > Programs/Features > Uninstall Git
Reboot Windows
Reinstall Git-2.38.1-64-bit as "Admin"
Carefull check all the options, especially:
"Windows Explorer Integration: Git Bash Here, Git GUI Here
<= These are checked by default ... and I'm sure they were both "Y" on the initial install
I copied my .gitconfig ("C:\Users\USERNAME.gitconfig") from another PC
<= I don't believe this was "essential" ...but I thought I'd mention it...
Browse to a local Git repo and verify the Git context menus work
<= Success after reinstall!

- 114,292
- 17
- 138
- 190
I updated my git and I marked the option of "Git Bash Here"
-
Please can you add some comments. What is the new version? And which windows version do you use? Was an restart necessary? – Th. Thielemann Oct 31 '17 at 23:11
I have already too many programs that want a spot on my PATH list. Rather than pollute my PATH list, I choose instead to add a symbolic link, from an elevated command prompt, like so.
mklink C:\bin\git-bash.exe "C:\Program Files\Git\git-bash.exe"
While there are exceptions, this works in the majority of cases, including, among others, the 7-zip CLI, selected SysInternals command line tools, the NuGet CLI, and many others.
As a bonus, having the Git Bash command line interface so readily accessible makes activating it from an open command prompt window trivial. With this improvement, I can probably live without yet another item on my context menu for directories.

- 1,039
- 12
- 19
In addition to the answers with the theory and the minimal examples see the example of the .reg
file for Git (and not only, with the instruction) with user-friendly names, shortcut keys (& in a user-friendly name) and icons in the "win-registry-snippets" repository

- 621
- 2
- 7
- 17
Do Nothing.
Just open your git bash terminal and type in:
git update-git-for-windows
Once update is completed, this will automatically add "Git Bash here" into your context menu.
Refer this: https://stackoverflow.com/a/65467670
You can install TortoiseGit for Windows and include integration in context menu. I consider it the best tool to work with Git on Windows.

- 5,836
- 3
- 30
- 44
-
1It's good but there is no button 'run bash here' like it was requested in this topic. – Ievgen Jun 28 '21 at 16:57
Add the git
path to the Environment-path variable (e.g. C:\Program Files\Git\cmd
) by which you can access git
from any folder using command line.

- 4,695
- 4
- 28
- 39

- 436
- 5
- 11