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.
Requirements:
Linux server with Ubuntu 22.04 or 24.04 OS installed.
1. Installation
As recommended during all installations, firstly we should update the server repositories:
sudo apt update && sudo apt upgrade -y
When the update will be completed, install git:
sudo apt install git -y
You can check what version was installed via using:
git --version
At the moment of writing this guide, the version should be shown as:
git version 2.43.0
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:
git config --list
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.