How To Install Git on Rocky Linux 9
In this tutorial, we will show you how to install Git on Rocky Linux 9. For those of you who didn’t know, Git is a distributed version control system used to track file changes to coordinate work on those files among team members. It is well known that nowadays, many applications, and many developers rely on Git for their daily work because of its simplicity, robustness, and integration with many other continuous integration tools.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of Git on Rocky Linux. 9.
Prerequisites
- A server running one of the following operating systems: Rocky Linux 9.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Git on Rocky Linux 9
Step 1. The first step is to update your system to the latest version of the package list. To do so, run the following commands:
sudo dnf makecache --refresh sudo dnf install dnf-utils
Step 2. Installing Git on Rocky Linux 9.
By default, Git is available on Rocky Linux 9 base repository. Now run the following command below to install the stable version of Git to your system:
sudo dnf install git
You can verify the installed version by using the command below:
git --version
Step 3. Set up Git.
Now we set up standard settings such as names and e-mails, mainly around git commit messages:
git config --global user.name "idroot" git config --global user.email "mimin@idroot.us"
To verify that your name and email have been configured:
git config --list
Step 4. Creating Example Git Project
First, create the directory for users who want to make a new directory strictly for Git:
mkdir idroot-git cd idroot-git
Next, initialize the git local repository:
git init
You will see a terminal output stating the status of the directory being initialized:
ls -a .git
To have the Git status, the command is:
git status
To list all git commands and sub-commands:
git help -a
Congratulations! You have successfully installed Git. Thanks for using this tutorial for installing Git on your Rocky Linux 9 system. For additional help or useful information, we recommend you check the official Git website.