How to Install Git on Ubuntu 14.04

Introduction

 

Git is a distributed revision control and source code management system released in 2005 and distributed under GNU General Public License v.2. Git handles large amounts of data and possesses tracking capabilities which are non-dependent on network access or central server.

This tutorial will cover the installation of Git on Ubuntu 14.04. Here, we will be showing you the installation in two different ways which have their unique benefits.
 

Installation of Git Using Apt-Get

 

Using apt-get method is the easiest and fastest way to install git. After updating your local package index, you can download and install the program:

sudo apt-get update
sudo apt-get install git

 

Git is installed in your system. However, you will have to do some configuration changes that we will be covering up later in this tutorial.

Installation of Git from Source

 

This method takes some time to install, but will provide you with the latest release.  In case if you want the latest version of Git to be installed from source, here is how:

Before starting the installation, update the system packages using apt-get update.

sudo apt-get update

Now, you need to download the required dependencies using the command:

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

 

Now, install the latest version of Git from git project’s page on GitHub. If you want to get the latest release, you can change the branch to latest non-rc option. Now, you can click the Download ZIP button on the right side of the page and select the option Copy Link Address. Refer to the snapshots below:

git-ubuntu14.04

 

git_ubuntu

 

Next, run the following wget command:

wget https://github.com/git/git/archive/v1.9.2.zip -O git.zip

Unzip the file and switch to that directory:

unzip git.zip
cd git-*

 

Global installation would require two steps – installing as yourself and as root user.

make prefix=/usr/local all
sudo make prefix=/usr/local install

 

You can update the Git in future using:

git clonehttps://github.com/git/git.git

 

Git Set Up

 

Once Git is installed, you need to copy your username and email in the git config file.

Open the config file and add the following lines of code to it:

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

If you want to verify the settings, you can use the command:

git config --list

The output should look similar to this:

user.name=Your Name
[email protected]

In case if you omit the step of updating your username and email, Git may throw a message similar to this:

[master 0d9d21d] initial project version 
Committer: root 
Your name and email address were configured automatically basedon your username and hostname. Please check that they are accurate.You can suppress this message by setting them explicitly:
     git config --global user.name "Your Name"
    git config --global user.email [email protected]
 After doing this, you may fix the identity used for this commit with:
     git commit --amend --reset-author

 

Git is successfully installed on your system.

support2 has written 111 articles

Leave a Reply