Installing Git in Home Directory - CentOS 5 - NO ROOT

masonk picture masonk · Apr 15, 2010 · Viewed 7.7k times · Source

At work, development doesn't have revision control. By this I mean that we are only allowed to check into the P4 depot when the change set is ready for regression testing. We can't check in intercolary changes! There are a host of problems with having no revision control during development that I don't need to go into here. Instead, I brought the problem to prodsys and they said, "no, but what you do in your home directory is your business". Basically, I can install it myself if I want it.

Unfortunately, I can't install it myself, because I'm on CentOS 5 at work and I don't have root. Yum won't give you the time of day if you don't have root. So what can I do to get git? I'm fine with statically linked binary if that makes it easy, but I can't find such a thing anywhere. I'm also looking for git-p4.

Edit: I've downloaded the tarball but I think I'm missing deps. I've read through the INSTALL doc and opted out of every optional dependency:

make prefix=$HOME/git NO_TCLTK=YesPlease NO_OPENSSL=YesPlease  NO_CURL=YesPlease  NO_EXPAT=YesPlease

But I still can't build.

I get this error:

: command not foundline 2:
: command not foundline 5:
: command not foundline 8:
./GIT-VERSION-GEN: line 14: syntax error near unexpected token `elif'
'/GIT-VERSION-GEN: line 14: `elif test -d .git -o -f .git &&

and it builds a lot of .o's until I get to:

...
LINK git-daemon
make: *** No rule to make target `GIT-VERSION-FILE', needed by `git-am'.  Stop.`

And I'm stuck again.

Answer

Cascabel picture Cascabel · Apr 15, 2010

Chris Kaminski already linked to the git site (though the true url is http://git-scm.com/). There's a download link for a tarball there. You can also clone the git.git repo:

 git clone git://git.kernel.org/pub/scm/git/git.git

 git clone http://www.kernel.org/pub/scm/git/git.git   # if behind a firewall

Either way, all you'll have to do is make install - the default prefix is $HOME, placing files in $HOME/bin, $HOME/libexec, and so on. If you want to keep it partitioned (a good idea, since there's no uninstall rule), just use the prefix option, e.g. make prefix=$HOME/git.