Convert portable msysGit to full installed equivalent (but still be portable)
-
22-12-2020 - |
题
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?
解决方案
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.
其他提示
My MsysGit was installed in directory "f:\git177". so my githere.reg file in windows 2003sp2 is :
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\git_gui]
@="Git &GUI Here"
[HKEY_CLASSES_ROOT\Directory\shell\git_gui\command]
@="f:\\Git177\\bin\\wish.exe \"f:\\Git177\\libexec\\git-core\\git-gui\" \"--working-dir\" \"%1\""
[HKEY_CLASSES_ROOT\Directory\shell\git_shell]
@="Git Ba&sh Here"
[HKEY_CLASSES_ROOT\Directory\shell\git_shell\command]
@="wscript \"f:\\git177\\Git Bash.vbs\" \"%1\""