How to build / compile / install a High Performance / Latest Version (1.8.3 or later) of Git version control system from Source on Ubuntu 12.04 / 12.10 / 13.04 Server/Desktop

Installing Git on Ubuntu can be as simple as this:

Method 1: The easiest and Ubuntu recommended way - using the Ubuntu package manager:
sudo apt-get install git-core
Done!

Well, it takes quite some time for the latest version of Git to reach the Ubuntu repos - as of now, the repo version is around 4 months older than the actual version of Git out there.

To install those, you need to Build/Compile/Install from the latest version of the source code.

Here is how you do that:

Method 2: Build from source - the normal method to get the latest version
To get the latest version manually (the repo version is almost 4 months old now), we should build it from source.

Prerequisites to build Git:
sudo apt-get update
sudo apt-get install autoconf automake checkinstall
sudo apt-get install build-essential
sudo apt-get install zlib1g-dev libssl-dev libcurl4-openssl-dev libcurl4-openssl-dev libexpat1-dev asciidoc
sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
sudo apt-get install ssh expat zlib1g zlib1g-dev tk python
!!AROUND 700MB download: sudo apt-get install asciidoc docbook2x

wget https://git-core.googlecode.com/files/git-1.8.3.tar.gz
wget https://git-core.googlecode.com/files/git-manpages-1.8.3.tar.gz
tar -zxvf git-1.8.3.tar.gz
cd git-1.8.3/

For a normal git build:
make configure
./configure
make all doc info
sudo make install install-doc install-html install-info

For a bit more highly performance optimized git later - useful if you are going to use git for huge repos (!!VERY LONG build time - could take upto an hour)
make configure
./configure --prefix=/usr/local
make prefix=/usr/local PROFILE=BUILD all doc
sudo make prefix=/usr/local PROFILE=BUILD install install-doc install-html install-info

Now, to keep your machine updated with the latest git version every time,
Go to http://git.kernel.org/cgit/git/git.git/ to see the latest version
git clone git://github.com/git/git.git
git fetch
Do a 'git tag' to list all available tags.
'git checkout' to the tag of your preferred version.
then do the abovementioned build, compile, install steps.

References:
1. 3 ways to install Git on Linux (Ubuntu):
http://evgeny-goldin.com/blog/3-ways-install-git-linux-ubuntu/

2. How to install Git on Ubuntu 12.04:
https://www.digitalocean.com/community/articles/how-to-install-git-on-ub...

3. And here is a good beginner tutorial:
http://try.github.io/

Add new comment

randomness