Introduction
Git is a version control system that is designed to monitor changes to files and manage the history of those changes. Git also allows multiple people to collaborate on the same project at the same time, maintaining a history of each participant's changes.
In this guide you will learn how to install and setup git on CentOS 7 and AlmaLinux 8.
Please note
CentOS 7 has reached EOL, so you may encounter a mirror issue during installation. To solve the problem, you can refer to this guide.
Installation Guide
1. Install Git
To install git, run the following command:
yum install git
To ensure that git was installed successfully, check the git version:
git --version
The output will provide you the information about the installed git version.
2. Set Up Git
You need to provide correct user information for Git. Run these commands (enter your actual username and email):
git config --global user.name "username"
git config --global user.email "admin@yourdomain.tld"
This will help you avoid Git errors in the future.
You can recheck specified information by entering:
git config --list
3. Modify Git User Data
You can also anytime edit data via a git configuration file. Enter this command to open it:
vi .gitconfig
Inside you will see the data you provided earlier:
If you want, you can modify this data it and save changes (press "Esc", then type :wq and click "Enter").
Conclusion
That's it! You have Git installed and are ready to use it on your server.
You can find more information about Git on the official project website.