How to add "open git-bash context menu here ..." to Windows Explorer?

How to add a context menu (aka right click) to Windows Explorer, which, when clicked, opens the git - bash console in the current explorer folder?

+49
git contextmenu windows-explorer
Jun 24 '14 at 12:28
source share
10 answers

I had a similar problem and I did it.

Step 1: Type "regedit" in the Start menu

Step 2: Launch Registry Editor

Step 3: Go to HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\Background\shell

Step 4: Right-click on the “shell” and select “Create”> “Key”. name the key "Bash"

Right click on

Step 5: Change the value and set its value to "open in Bash". This is the text that is displayed by clicking the right mouse button.

enter image description here

enter image description here

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

enter image description here

enter image description here

enter image description here

Close the registry editor.

Now you can see this option in the right-click menu in Explorer

PS Git Bash selects the current directory by default.

EDIT . If you need a one-click approach, check out the Ozesh solution below

+66
Aug 28 '16 at 18:59
source share

Step 1. On the desktop, right-click "Create" → "Text Document" named OpenGitBash.reg

Step 2. Right-click the file and select “Modify”

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

Step 4. Run the file by double-clicking it

Note. Administrator permission is required for writing 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

+54
May 17 '17 at 8:48
source share

You can install git for windows or Github for windows, both give you a choice during installation 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/

+5
Jun 24 '14 at 12:30
source share

I am less than 50 points, so I can not directly respond to the message Shaswat.

What worked for me was almost like that, but with the following REGEDIT option:
HKEY_LOCAL_MACHINE/SOFTWARE/Classes/Directory/background/shell and here I created a Bash key 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 am on Windows 10 and have a new git installation that did not automatically add this for any reason (git version 2.12.0 64bit)

+4
Mar 15 '17 at 23:48
source share

Here is the registry export ( *.reg ) for the 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 more information about *.reg see " How to Add, Modify, or Delete Partitions and Registry Values ​​Using a .reg File " from Microsoft.

+4
Apr 24 '17 at 19:55
source share

Normally, git bash here can only be run in directories, so you need to go to the directory and right-click on the previous directory, and then select git bash here (of course, on Windows).
Note : the context menu inside the directory does not have the git bash here option.

+1
Dec 11 '15 at 11:26
source share

You can install TortoiseGit for Windows and enable integration in the context menu. I consider this the best tool for working with Git on Windows.

0
Jun 24 '14 at 12:56 on
source share

Like, @Shaswat Rungta said: "I think the question is how to add it after the installation is complete."

On my PC (Windows 7), I think the “Git Bash here” command disappeared after installing Visual Studio 2017.

I fixt is to download and install git again.




NOTE: "When installing Git for Windows, the context menu options are not 'on' by default. You will need to select them during installation." - @nbushnell ( I did it )
0
Apr 02 '17 at 17:48 on
source share

I updated my git and I marked the option "Git Bash Here"

0
Oct. 31 '17 at 22:50
source share

Add the git path to the environment path variable (for example, C:\Program Files\Git\cmd ), with which you can access git from any folder using the command line.

-2
Sep 07 '16 at 19:08
source share



All Articles