gitmsysgitportable-applications

Convert portable msysGit to full installed equivalent (but still be portable)


Being a fan of portable apps (even when running on my primary workstation), I use the portable version of msysGit, however, it does not install the shell hooks, environment variables, GUI setup, icons etc. I would like to keep my C:\ and installed apps to the original clean image provided by my employer so that whenever they provide a new Windows image, I don't have to reinstall all the portable apps (including Git).

Is there any script available that allows the portable version to simply be "registered" with the shell hooks (Git Bash Here / Git GUI here) and icons (but not installed)?

To ask another way, if I install the full version to say, D:\PortableApps\Git, would it be functionally equivalent to the portable version in terms of centralizing all file storage?


Solution

  • Cut-n-paste the following in a file (say install.reg) and double-click it.

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\git_gui] @="Git &GUI Here"

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\git_gui\command] @="\"D:\PortableApps\Git\bin\wish.exe\" \"D:\PortableApps\Git\libexec\git-core\git-gui\" \"--working-dir\" \"%1\""

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\git_shell] @="Git Ba&sh Here"

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\git_shell\command] @="wscript \"D:\PortableApps\Git\Git Bash.vbs\" \"%1\""

    Create a shortcut named Git Bash.lnk with the following target:

    C:\WINDOWS\system32\cmd.exe /c ""D:\PortableApps\Git\bin\sh.exe" --login -i"

    Your portable Git is now registered with the Windows shell.