Credit
Credit goes to Boyan Iliev for giving me this idea!
Checking to see if already installed
The option of installing with default packages is best if you want to get up and running quickly with Git, if you prefer a widely-used stable version, or if you are not looking for the newest available functionalities. If you are looking for the most recent release, you should jump to the section on installing from source.
Git is likely already installed in your Ubuntu server. You can confirm this is the case on your server with the following command:
git --version
Output
git version 2.25.1
However, if you did not get output of a Git version number, you can install it with the Ubuntu default package manager APT.
Installing Git
First, use the apt package management tools to update your local package index.
sudo apt update
With the update complete, you can install Git:
sudo apt install git
You can confirm that you have installed Git correctly by running the following command and checking that you receive relevant output.
git --version
Output
git version 2.25.1
That’s it, you have successfully installed Git on your Ubuntu Server and you can start using it!
git init
Make sure to do in the directory you want.