How To Install Git on Ubuntu

Git is an open source, distributed version control system. It’s all the rage right now with sites like GitHub offering a social coding experience, and popular projects such as Perl, Ruby on Rails, and the Linux kernel using it.

The preferred way to install Git on Ubuntu is to use the packages which are distributed with your operating system. They are often very well tested and they are pre-compiled, removing the need for installing and compiling everything from source.

We will start by updating the repositories on the server from the latest ones online, as well as upgrade the server if there are any old packages. This is good practice in general, you can do this by running the following command:

# apt-get update
# apt-get upgrade

Once we’re done with that, we can go ahead and install Git with all of it’s requirements. The following command will ask for a confirmation before it installs everything, you can type y and press enter afterwards to start the installation:

# apt-get install git-core

Once this process is done, you should be ready to configure git. There are plenty of resources which explain how to do it, but you can start by doing the basic configuration by running the following command:

# git config --global user.name "John Appleseed"
# git config --global user.email john@appleseed.com

You would replace the name and email above with your own information. You should now be ready to use Git on Ubuntu with no problems.

Try this tutorial on an SSD cloud server for $5.00/month only!

Built for Developers: 512MB RAM, 20GB SSD Disk and 2TB Transfer. 30 second setup.