How To Install Git on Ubuntu 14.04

Overview

In this tutorial we’ll learn how to install git on Ubuntu 14.04 (Trusty Tahr).

Git is a free and open source distributed version control system (VCS) designed to handle all project from small to large with speed and efficiency.

Originally created by Linus Torvalds in 2005 and maintained by Junio Hamano since July 2005.

You can visit git website to learn more about git usage.

Let’s start installing git.

Install Git from Ubuntu 14.04 repository

Ubuntu 14.04 already shipped with git version 1.9.1. Let’s install git from repository.

Update repository metadata using command below


$ sudo apt-get update

Now let’s install git


$ sudo apt-get install git

install git ubuntu 14.04

Check installed git version


$ git version
git version 1.9.1

Install Git from PPA repository

If we check on git website, at the time of this writing the latest stable version of git is 2.13.3.

We can install the latest stable git from git core PPA repository.

Add git-core PPA repository


$ sudo add-apt-repository ppa:git-core/ppa
 The most current stable version of Git for Ubuntu.

For release candidates, go to https://launchpad.net/~git-core/+archive/candidate .
 More info: https://launchpad.net/~git-core/+archive/ubuntu/ppa
Press [ENTER] to continue or ctrl-c to cancel adding it

Press ENTER


gpg: keyring `/tmp/tmpb_shleu6/secring.gpg' created
gpg: keyring `/tmp/tmpb_shleu6/pubring.gpg' created
gpg: requesting key E1DF1F24 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpb_shleu6/trustdb.gpg: trustdb created
gpg: key E1DF1F24: public key "Launchpad PPA for Ubuntu Git Maintainers" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK

Update apt-get metadata by running command below


$ sudo apt-get update

Install git


$ sudo apt-get install git

Now when we check git version


$ git version
git version 2.13.0

We already use the latest version of git installed (minus the .3 patch).

Summary

In this tutorial we learned how to install git from Ubuntu repository and also latest version of git from git-core PPA repository.