git-for-windows/git

Can't find "git bash here" in context menu when I am in windows libraries

Closed this issue · 15 comments

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options

git version 2.13.0.windows.1
built from commit: eba7af3dbb4c846c6303c5f64102acee696c9ab0
sizeof-long: 4
machine: x86_64
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.10586]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

Path Option: Cmd
SSH Option: OpenSSH
CURL Option: WinSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Disabled
Enable Symlinks: Disabled

Details

I have multi git repositories on my computer,and they are in different folders.
So,I am using the libraries to include the repository,then I can quickly find the repository in the library I created.
But when I right click in a repository I opened in library.I can not find the "git bash here" in the context menu.
how-to-use-libraries-in-windows-10

dscho commented

how-to-use-libraries-in-windows-10

From this link:

unlike a folder, a Library gathers files that are stored in several locations. This is a subtle, but important, difference. Libraries don't actually store your files, just shortcuts to them.

That means: it is not a directory. You cannot create directories in it, including .git. It cannot be the current working directory of any program, including Git Bash.

In short: this is probably never going to work.

@dscho Hi, I have test it. I can create a new folder in library.
When I right click,I can see the context menu from TortoiseGit
default

The default path showed is Librarie-->Git-->gitignore
When I click the path,it become the actual path directly.
default
default

dscho commented

This is how Git for Windows installs Git Bash Here: https://github.com/git-for-windows/build-extra/blob/a8f38d62572a4b5c8477ebeb0857316ba36c3016/installer/install.iss#L1988-L1999.

If anyone figures out which other registry keys we would need to add to support Libraries, I'll be happy to merge a Pull Request adding said support.

dscho commented

(A quick look at https://msdn.microsoft.com/en-us/library/windows/desktop/cc144110(v=vs.85).aspx did not reveal anything that would jump into my eye.)

@chucklu After some further testing, I got a workaround for you: Using Right click on folder

See:

Further testing...

Good 1

image

Bad 1

image

Good 2 (Can be a workaround)

image

Bad 2

image

@YueLinHo thanks a lot

@dscho Could you reopen this issue,maybe someone can fix this. Or you can add a label "help wanted",thanks.

@dscho would you fix this ?or reopen it?

dscho commented

would you fix this ?

As I mentioned earlier, I have no idea whatsoever whether this can be fixed.

or reopen it?

You will have to put in some effort to show that your wish can be addressed, that it is possible to initialize a repository in a Library. Otherwise it would just waste everybody's time if I reopened this ticket.

@dscho I have test it,I can create a repository in Library folder by TortoiseGit
You can check the screenshot
default
default
default

@dscho Based on your comment which shows me the way how GfW to add context menu items. I studied some, then, I finally found the possible way to go, that I use the following registry:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_gui]
@="Git &GUI Here"
"Icon"="C:\\Program Files\\Git\\cmd\\git-gui.exe"

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_gui\command]
@="\"C:\\Program Files\\Git\\cmd\\git-gui.exe\" \"--working-dir\" \"%v.\""

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_shell]
@="Git Ba&sh Here"
"Icon"="C:\\Program Files\\Git\\git-bash.exe"

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\git_shell\command]
@="\"C:\\Program Files\\Git\\git-bash.exe\" \"--cd=%v.\""

Before

gi_1229_before

After

gi_1229_after


For a record, TortoiseGit uses Shell Extension, not Shortcut (Context) Menus which is used by GfW.

dscho commented

@YueLinHo what a lovely contribution, thank you so much!!!

@dscho Thanks for your help. b^^d

@YueLinHo @dscho Thanks a lot!