Install git on server without sudo
I'm trying to install git
on a server with a user that does not have root access. I've seen a lot of tutorials that suggest using ./configure
, but when I downloaded the latest git zip from github, there was no such file. Apparently it should just work with make
and make install
, but when I run make
, I get errors:
In file included from credential-store.c:1:
cache.h:21: error: expected specifier-qualifier-list before 'z_stream'
make: *** [credential-store.o] Error 1
Apparently this has to do with zlib
not being installed. I can download zlib
, but I have no idea how to get git
to know where I have installed it. There may be other dependencies as well but I can probably handle them in a similar way.
I'd also like to just have the git
executable alone in /home/user/bin
without other folders or crap in there. Is there any way I can just download the compiled executable? Because that would be fine too.
Solution 1:
While I don't currently have time to provide a super detailed answer, I can outline a possible strategy for running executables from a pre-built git
package under your home directory. This response is aimed at Debian, since that's what you said you're using, but the basic concept is applicable to other OSes and distros as well.
First, go to http://packages.debian.org/squeeze/git and review the dependencies of the git
package. Luckily, you'll find that git
doesn't have that many. Most of the important ones are probably already installed, maybe with the exception of libcurl3-gnutls
and libexpat1
.
Next, download the binary .deb package and extract its contents (search the web to find out how to extract a .deb package manually). You'll find a data.tar.gz
file. Extract that, and you'll get usr/bin/git*
and usr/lib/git-core/*
files. You can put these files somewhere under your home directory. Now the critical part: /usr/bin/git
calls out to numerous "helper" programs under /usr/lib/git-core
, and this latter path is hardcoded into /usr/bin/git
. Luckily, you can override the hardcoded value by setting the GIT_EXEC_PATH
environment variable, so update your dotfiles to point to where you decided to keep the various /usr/lib/git-core
files.
Finally, it's possible that not all of the library dependencies (and their dependencies, etc, etc) were installed on your system (e.g., libcurl3-gnutls
, libexpat1
). You can download the binary packages for these as well, and extract them under your home directory, and then help git
find them by setting your LD_LIBRARY_PATH
environment variable appropriately.
P.S. I've probably had more than my fair share of being in your position, so what I've outlined above is more than theoretical. But working around this sort of problem is a little bit of a black art, so there will usually be some additional fussing around involved. Good luck.