I've managed to put together a solution based on ideas from several different people (thanks to all of you):
- Download the Git binary for Mac OSX from git-scm.com. The downloaded DMG contains a PKG file.
- Unpack the PKG file with unpkg or something similar. (This step is necessary because normally PKG files can only be installed with root privileges.)
- Drop the
etc
andgit
folders that were just unpacked onto your USB stick.
Now, whenever you plug in your USB stick, just make sure to put the location of the git
directory on your PATH
(like this: export PATH=$PATH:/path/to/git/on/usb/stick
) and you'll be good to go!
NOTE: I've tested many of the git
commands using this method and most seem to work without any issues. However, git init
will complain like this: warning: templates not found /usr/local/git/share/git-core/templates
. Not surprising since the templates are actually on your USB stick and not /usr/local
. Despite this warning my repos seem to be working just fine.