How to add a "Git Bash Here" context menu option to the windows explorer in Windows 11?
Asked Answered
L

4

14

I've recently switched to Windows 11 and after installing git, I found out that the context menu option, to easily launch git bash, is not there. The good news is, that it is possible to access the old style context menu, along with the desired "git bash" option, when clicking on Show more options button. But it would be nice to be able to access the button with one right click (in the main Windows 11 context menu). My question is: how to add the Git Bash Here context menu option in Windows 11 (for the main context menu)?

Here's what context menu in W11 looks like atm: enter image description here

Here's what it look like after clicking the Show more options button: enter image description here

Ideally, I would like to have a similar solution, that is provided for Windows 10 here, but for the main (first) context menu in Windows 11.

Leopardi answered 5/12, 2021 at 19:17 Comment(0)
L
0

Okay, I finally came back here with a solution. Also attaching a bunch of screenshots, since many of us are not yet that well familiar with the Windows 11 UI. So here are the steps you need to take to make Git Bash or Git Cmd to be open from the first context menu of Windows 11:

  1. Right Click and open a new terminal window ("Open in Terminal" option). enter image description here
  2. On the top, right next to the tab, click on the drop-down menu and the click on "Settings" button.enter image description here
  3. Once the settings are open, scroll down on the left side and select "Add a new profile" option.enter image description here
  4. Either select "+ New empty profile" option or "Duplicate" option in the opened section.
  5. Fill out the fields you need, as you want: Name, app to launch (git-bash.exe or git-cmd.exe), icon etc. Click "Save". Most probably Git executables are sitting somewhere similar to this place on your machine: C:\Program Files\Git. Git icon can be found somewhere in this place: C:\Program Files\Git\mingw64\share\git. P.S. if you go with git-bash, then 2 windows will be launching for whatever reason.enter image description here
  6. Once the new profile is created, go ahead and choose it as the default option and click "Save".enter image description here

Now you should be able to repeat the step #1 and witness your selected app opening by default. Hope this helps. Tried to make it as detailed as possible and added screenshots for better visibility.

Leopardi answered 8/8, 2023 at 18:37 Comment(0)
L
1

Unfortunately, at this point in time, there is not way to configure the new Windows 11 context menu. However, as a possible solution, you can enable showing full context menu by default (like it's in Windows 10). It can get the job done, but I don't think that's the most graceful solution. I'd say it's far not the one, but still can be an option for some folks out there.

To do that, you just need to add {86ca1aa0-34aa-4e8b-a509-50c905bae2a2} key with subkey InprocServer32 under Computer\HKEY_CURRENT_USER\Software\Classes\CLSID and make sure that in InprocServer32, "Data" column has value and is set to default, empty value, like it's in the screenshot below.

enter image description here

P.S. You will need to restart your computer for changes to be applied.

Leopardi answered 5/12, 2021 at 19:49 Comment(4)
I am looking to do something similar, but for the wsl2, like when i right click in the folder and click to open wsl2 the path directory that open will be the same as the one from where it get opened, I have looked around but couldn't find anything similar if some one might have done already?Ovarian
@Ovarian unfortunately I cannot help you with that. Maybe it's worth creating a separate post for that if you can't find an existing answer in the forumLeopardi
You can extend the context menu with IExecuteCommand: blogs.windows.com/blog/2021/07/19/…Cottonweed
This answer is pretty outdated now, I have added more relevant and better options, would recommend to use those instead.Leopardi
L
1

If you don't want to modify the Open in Terminal button behavior, you can simply use Shift + Right Click to open the more familiar Windows 10-like context menu and access the git bash from there (ofc. if you have that add-on installed during the git installation process).

Leopardi answered 9/8, 2023 at 11:24 Comment(0)
L
0

Okay, I finally came back here with a solution. Also attaching a bunch of screenshots, since many of us are not yet that well familiar with the Windows 11 UI. So here are the steps you need to take to make Git Bash or Git Cmd to be open from the first context menu of Windows 11:

  1. Right Click and open a new terminal window ("Open in Terminal" option). enter image description here
  2. On the top, right next to the tab, click on the drop-down menu and the click on "Settings" button.enter image description here
  3. Once the settings are open, scroll down on the left side and select "Add a new profile" option.enter image description here
  4. Either select "+ New empty profile" option or "Duplicate" option in the opened section.
  5. Fill out the fields you need, as you want: Name, app to launch (git-bash.exe or git-cmd.exe), icon etc. Click "Save". Most probably Git executables are sitting somewhere similar to this place on your machine: C:\Program Files\Git. Git icon can be found somewhere in this place: C:\Program Files\Git\mingw64\share\git. P.S. if you go with git-bash, then 2 windows will be launching for whatever reason.enter image description here
  6. Once the new profile is created, go ahead and choose it as the default option and click "Save".enter image description here

Now you should be able to repeat the step #1 and witness your selected app opening by default. Hope this helps. Tried to make it as detailed as possible and added screenshots for better visibility.

Leopardi answered 8/8, 2023 at 18:37 Comment(0)
L
0

For those of you who like working with json and not do things through the UI, here's what you need to do: Follow the steps #1, #2 from the main asnwer:

  1. Right Click and open a new terminal window ("Open in Terminal" option).

  2. On the top, right next to the tab, click on the drop-down menu and the click on "Settings" button.

  3. Scroll down similarly and this time choose "Open JSON file" option.

  4. Look for "profile" section and "list" child section nested under it.

  5. Add a comma (',') after the last object in the "list" and then add the following new object to the "list" collection:

    {
        "colorScheme": "Campbell",
        "commandline": "C:\\Program Files\\Git\\git-cmd.exe",
        "guid": "{9f8d6902-3250-4651-b8d0-4bfecacf3929}",
        "hidden": false,
        "icon": "C:\\Program Files\\Git\\mingw64\\share\\git\\git-for-windows.ico",
        "name": "Git cmd",
        "startingDirectory": "%USERPROFILE%"
    }
    

P.S. values are for example purposes and may differ on you machine. Make sure to provide the right path to the desired executable file and icon (if you want one).

Leopardi answered 8/8, 2023 at 18:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.