Install Git on Ubuntu with Apt-Get

Installing Git with apt-get is a quick and easy process. The program installs on the virtual private server with one command:

Install Git from Source
If you are eager to download the most recent version of Git, it is generally a good idea to install it from the source.
Quickly run apt-get update to make sure that you download the most recent packages to your VPS.

Prior to installing Git itself, download all of the required dependancies:

Once they are installed, you can download the latest version of Git from the google code page.

After it downloads, untar the file and switch into that directory:

If you want to do a global install, install it once as yourself and once as root, using the sudo prefix:

How to Setup Git
After Git is installed, whether from apt-get or from the source, you need to copy your username and email in the gitconfig file. You can access this file at ~/.gitconfig.
Opening it following a fresh Git install would reveal a completely blank page:

You can use the follow commands to add in the required information.

You can see all of your settings with this command: