Git can be installed in two ways.
Installing Git with apt-get is quick and easy. The program installs on the virtual private server wit one command:
sudo apt-get install git
After it finishes downloading, Git will be installed and ready to use.
To obtain the most recent version of Git, install it from source.
Update apt-get to make sure that the most recent packages are downloaded:
sudo apt-get update
Prior to install Git itself, download all of the required dependencies:
sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev build-essential
Download the latest version of Git:
Untar the archive and change the directory to it:
tar -zxf git-126.96.36.199.tar.gz cd git-188.8.131.52
For a global install, install it once as yourself and once as root, using the sudo prefix:
make prefix=/usr/local all sudo make prefix=/usr/local install
git clone git://git.kernel.org/pub/scm/git/git.git
After Git is installed either from apt-get or from the source, it need to be configured with username and email in the gitconfig. This file can be be accessed at ~/.gitconfig
Opening right after Git installation whould reveal a bank file:
sudo nano ~/.gitconfig
Add the required information with the following commands:
git config --global user.name "NAME" git config --global user.email "firstname.lastname@example.org"
All settings can be seen with this command:
git config --list