How to Install Git on Ubuntu 14.04

Installation of Git Using Apt-Get

You can use apt-get to install git. When you have updated your package index, just 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

 

Install the latest version of Git here: git project’s page on GitHub. If you want to get the latest release, change the branch to latest non-rc option.  Click the Download ZIP button (right side of the page) select the Copy Link Address option. Snapshots below:

git-ubuntu14.04

 

git_ubuntu

 

Next, run this wget command:

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

Unzip file then switch to that directory:

unzip git.zip
cd git-*

 

Global installation requires 2 steps – installing as yourself and installing as a root user.

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

In the future, you can update the Git using this:

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

 

Git Set Up

Copy your username and email in the git config file once Git has been installed.

Add these lines of code in the config file:

 

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

Use this command to verify the settings:

git config --list

Output should resemble this:

user.name=Your Name
[email protected]

Git may give you a message like this if you omit the step of updating your username and email:

[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 has been now been successfully installed.

Nikole Fast has written 1 article