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 have a non-sudo account on a shared host. I want to be able to run the git-core for version control. I have another server that I am using for the git-repo.

How can I install a version of git inside of my user folder and execute that.

I have shell access and the server is CentOS/Redhat/Fedora.

share|improve this question

1 Answer 1

If you have access to the compiler, you should be able to download the source archive, build it, and install it in your home directory.

You can get a source archive from http://www.kernel.org/pub/software/scm/git/. The most recent release is 1.7.4.2, so you would get git-1.7.4.2.tar.bz2. You may also want git-manpages-1.7.4.2.tar.bz2 and/or git-htmldocs-1.7.4.2.tar.bz2. There are .gz versions available if you can not uncompress .bz2 files.

Git’s Makefile actually defaults to installing in your home directory. If you already have a well populated ~/bin (etc.) and you want to install Git separately, then you can have it install everything under a some other “prefix” in your home directory. Using a unique prefix also makes it easy to uninstall or wipe and upgrade.

make install prefix="$HOME/git"

The Makefile has many comments describing the variables that control the build process. It also includes reasonable defaults for most platforms. You can tweak any of the settings by editing the file itself or putting your customizations in a config.mak file (it is automatically included if it exists).

Unless you are on an exotic system, you can skip using ./configure. The autoconf stuff works, but sometimes it rusts a bit since most of Git’s developers just use the Makefile directly.


If you do not have access to the compiler on your target machine, then you will need access to a machine with a similar OS installation. Build with prefix set to the path that will be used on the target machine and set DESTDIR to a temporary location (on the build machine).

# On the "build" machine:
make install prefix=/home/dir/on/target/git DESTDIR=/tmp/git-dest
cd /tmp/git-dest/home/dir/on/target && tar cjf git-for-target.tar.bz2 git
# transfer the file to "target" machine

# On the "target" machine:
cd /home/dir/on/target && tar xjf git-for-target.tar.bz2
share|improve this answer

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.