How to install, configure and use GIT on an Ubuntu 14.04 LTS VPS

In the following article we are going to explain to you how to install and set-up GIT on an Ubuntu 14.04 VPS.

If you are looking for a full-featured GIT environment, we suggest you check our great article on how to install Gitlab, Ruby and Nginx on a Debian 7 (Wheezy) VPS.

What is GIT?

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.


Before installing and setting up GIT, make sure your Ubuntu Linux VPS is fully up to date by using the following commands:

## apt-get update
## apt-get upgrade



The best and fastest way to install GIT on your Ubuntu 14.04 VPS, is to use apt as in:

## apt-get install git-core



Once GIT is installed on your linux server, you may want to configure it using git config or its configuration file .gitconfig, though it is not required as GIT will work with no-configuration by default. Anyway, let’s set-up some GIT parameters using git config:

Set-up Name/Email

## git config --global user.name "My Name"
## git config --global user.email myname@example.com

Set-up Editor

## git config --global core.editor vim

Set-up Diff tool

## git config --global merge.tool vimdiff

Display GIT Configuration

## git config --list

to learn more about git config, refer to its man page.


You can easily create a GIT repository on your linux virtual server using something like this:

## mkdir -p /repos/my-git-project
## cd /repos/my-git-project
## git init --bare



Now, clone the repository you just created, add a sample README file, commit your changes and perform a push request using:

## cd /home
## git clone ssh://root@myserver.com/repos/my-git-project
## cd my-git-project
## echo test > README
## git add README
## git commit -m "Initial commit. Adding README file"
## git push origin master



Git status

changed files in your working repository

## git status

Git log

show all git commits

## git log

Git diff

made changes to tracked files

## git diff

Git branch

list all branches

## git branch

try searching the Internet to find out more git usage examples.

Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install GIT for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.


Categories: Tutorials

View Comments

Leave a Comment