Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
What OS and/or distro? –  jjlin Jul 19 '12 at 4:23
    
@jjlin Debian squeeze –  Explosion Pills Jul 19 '12 at 4:57
    
See also github.com/VonC/compileEverything –  VonC Aug 30 '12 at 4:14

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
    
I downloaded the core from ftp.us.debian.org/debian/pool/main/g/git/… and looked up how to extract the deb, but when I did all that is there is usr/share/doc/git-core which is a symlink to a nonexistent git file in the same directory. Is there another place to download the .deb? –  Explosion Pills Jul 19 '12 at 13:45
    
You need to download the git package, not git-core. –  jjlin Jul 19 '12 at 14:20

You have a lot of work ahead of you. You need to make sure their either wget or curl are available to you, since you will need one or the other of them to get the tarballs you need if the appropriate packages are not installed.

Create a

/home/youruser/src directory (mkdir -p /home/youruser/src).

cd into the src directory and get the source code to git

wget http://git-core.googlecode.com/files/git-1.7.11.2.tar.gz

Untar it, and do

./configure --help

This will show you all the needed packages you will need, like expat, openssl, etc. You will have to dowload all of them, build and install them in /home/youruser When you are done you will have /home/youruser/bin along with several needed directories.

Please, read the INSTALL file in the untarred directory, and post your progress.

share|improve this answer
    
The git you linked to is a bit different (I got the github source which doesn't have configure at all). I ran ./configure --with-zlib=/home/myname/zlib/ (that directory exists). It didn't seem to complain. However, when I run make I get the same error as above that seems to be a lack of zlib. I'm stuck there. –  Explosion Pills Jul 19 '12 at 13:37
    
Now, you need to download the source to zlib, unpack the tarball, do a ./configure --prefix=/home/youruser && make && make install and retry git. As I said, if you do ./configure --help with git you will get a list of packages it will want to have, they are marked [default=yes] or something like that. –  thisfeller Jul 20 '12 at 13:04
    
Note: all this work is done for you with github.com/VonC/compileEverything –  VonC Aug 30 '12 at 4:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.