Default repository often install old version of software. To get the latest version, best way is, install it from the source.

Here I am going to present how to install Git core with command line. I am going to use Ubuntu 12.04 LTS, as the environment.

Steps:

1. First, update the repository:
sudo apt-get update

2. Install some required dependencies:

sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev build-essential

3. Get the source file:

wget https://git-core.googlecode.com/files/git-1.8.1.1.tar.gz

4. Extract it
tar -zxf git-1.8.1.1.tar.gz
cd git-1.8.1.1

5. Install it for all users:
make prefix=/usr/local all
sudo make prefix=/usr/local install

6. If you need to update Git in the future, you can use Git itself to do it.

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

7. Configure Git:

sudo nano ~/.gitconfig

git config --global user.name "NewUser"
git config --global user.email [email protected]

8. You can see all of your settings with this command:
git config --list

You can change the command syntax for installing Git to other Linux distro such as CentOS or Fedora.
Hope this will help you to start the Git journey.

Comments

comments