Git - software that allows track changes, restore previous versions and create alternative file and folder versions on your OS. It is one of the most popular such kind of systems that allows using Git repositories for project management.
In this guide, you will see how to install and configure Git in Ubuntu 18.04 OS template.
0. Requirements:
Linux server with Ubuntu 18.04 OS template installed.
1. Installation:
As recommended during all installations, firstly we should update the server repositories:
sudo apt-get update
When the update will be completed, install git:
sudo apt-get install git -y
You can check what version was installed via using:
At the moment of writing this guide, the version should be shown as:
git version 2.17.1
When the installation is completed and you have checked the version, you can skip to 3rd step.
2. Git configuration.
When Git is installed, it's time to configure it, so that generated messages would have the correct information.
Required information can be saved using git --config command. In the following example, we will set a username and e-mail address, since Git uses this information in every message. This information can be added by following these commands:
git config --global user.name "your_username"
git config --global user.email "your_email"
To check what was saved, use:
The result of this command should look like this:
root@VPS:~# git config --list
user.name=your_username
user.email=your_email
This information is being saved in Git configuration file, that you can adjust manually if needed by any text editor:
nano ~/.gitconfig
The command should show you this result:
[user]
name = your_username
email = your_email
There are lots of options that you can set up with your Git configuration. However, the username and e-mail are mandatory for using Git successfully. If this step will be skipped, you will receive warnings from trying using Git.