In this tutorial we will show you how to install Git on Ubuntu 18.04. We will also install and configure its prerequisites. Git is a distributed version control program, which you can use to monitor the code varies (versions) while developing software. Git offers features such as reverting to a prior stage, multiple workflows, neighborhood branching and lots of others. This makes Git one of the best variant control systems and that is why it is used by many software developers.
I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 18.04 LTS Bionic Beaver minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.
Install Git on Ubuntu 18.04
Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:
apt-get update -y apt-get upgrade -y
Step 2. Installing Git on Ubuntu 18.04.
Now let’s install git:
apt install git
You can check the version of git that was installed by using the following command:
$ git --version git version 2.15.1
Step 3. Configuration of Git on Ubuntu 18.04.
The first thing that you might want to do after the installation is to configure your own name and email address in Git so the changes you commit contain the correct information. You can do that by using the following commands:
git config --global user.name "mona" git config --global user.email "email@example.com"
Next we’ll verify the configuration changes by viewing the .gitconfig:
git config --list
For more information and command line options you can use the –help flag: