Question

I'd like to be able to do some development work on public/borrowed computers (where I have no root privileges) and I've managed to get most of my tools working off of a USB stick but I still haven't found a Git solution.

The portable versions of Git that I have found are Windows-only. Do you know of any Mac alternatives?

EDIT: I've gotten a few suggestions to just copy my current installation of git from /usr/bin and put that on a USB drive. That's a great idea but I don't have a current installation of git to copy from. I won't have my own computer back for a couple of weeks.

Would you happen to know where I could grab a pre-compiled version of git for OSX? I don't have access to homebrew or... anything really. Ideally I could just grab a zip file from somewhere and dump it on my USB stick.

Was it helpful?

Solution

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 and git 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.

OTHER TIPS

Add a environmental variable GIT_TEMPLATE_DIR to quote the documentation

The template directory contains files and directories that will be copied to the $GIT_DIR after it is created.

The template directory will be one of the following (in order):

the argument given with the --template option;

the contents of the $GIT_TEMPLATE_DIR environment variable;

the init.templatedir configuration variable; or

the default template directory: /usr/share/git-core/templates.

I've uploaded my /usr/bin/git and /usr/bin/git-shell to

You can try those, but I have no idea if this approach is likely to work. (There are no interesting shared-library dependencies reported by otool -L, but I don't know what else might theoretically go wrong with the idea.)

FWIW, I use Mac OS X 10.8.2 and git version 1.7.10.2 (Apple Git-33).

Not sure if this is appropriate as an "answer", since I don't plan to leave those links working indefinitely. Maybe I (or someone) can delete this answer in a month or two.

Apple's command line tools for developers include git, I believe. You can find them on http://developer.apple.com/; you might need a free developer account. They package will want to install to /usr/bin etc., but you should be able to use pax to extract the contents wherever you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top