How to install Git on Ubuntu

git it is one of the most popular versions to control the system. You can manage the software code and monitor all changes, reverting changes by going back to previous versions of your code, or you can create new branches to use alternate code that you can merge with your original code later.

In this tutorial we will explain how to install Git on Ubuntu 14.04.

1.- Install Git in Ubuntu

Option 1: Install Git with Apt

To our luck, 14.04 contains Git in its default repertoires. So you can easily install using apt package manager. The first thing you have to do is run the command:

sudo apt-get update

Please note that your version of the repertoires may not be the newest. You can review the available versions with the command:

apt-cache policy git

An example would be:

git: Installed: (none) Candidate: 1:1.9.1-1ubuntu0.3 Version table: 1:1.9.1-1ubuntu0.3 0 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages 1:1.9.1-1 0 500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

For now there are two versions available: 1:1.9.1ubuntu0.30 and 1:1.9.1-10. Candidate Version is shown as the one that will be installed. To install git run:

sudo apt-get install git

Running this command will start the installation on your system.

2.- Install Git from GitHub

If you want to be sure that you are installing the latest version of Git, then you should install it from GitHub. Before starting the installation you will need to install some packages:

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

Now you have to go to and download the version you want to install.

See also  Linux Tee command with examples

In the tutorial we will install version v2.12.0, which can be extracted using:

tar -zxf v2.12.0.tar.gz

Although there is no problem if you want to use another version, you just have to change the name of the file to the version you want to install.

Now you will install Git locally by running:

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

2.- Configure Git

Once you have successfully installed Git you should start configuring it. The first thing you have to do is put your username instead of user_name using the following command:

git config –global user.name “user_name”

Now you have to enter your email account instead of:

git config –global user.email email@domain.com

3.- Basic list of Git commands

Git is now installed and configured correctly, but so that you don’t have any problems using it, using the following code you can see a complete list of all the commands that you can use to get the most out of Git:

git –help

further reading

conclusion

Once you have finished this tutorial you should already have Git installed and configured on Ubuntu 14.04. Remember that using the command I shared you can see the full list of all Git commands.

You can now manage code more effectively by creating branches, plus you can also revert changes and track code changes.

Remember that if you had any problem installing Git we can help you, contact us in the help section from your service profile and we will answer you immediately.

Gustavo is passionate about creating websites. He focuses on the application of SEO strategies at for Spain and Latin America, as well as the creation of high-level content. When he is not applying new WordPress tricks you can find him playing the guitar, traveling or taking an online course.

Loading Facebook Comments ...
Loading Disqus Comments ...