How to Install Git on Rocky Linux 8

Most developers rely on Git as the solution for version control of their applications. That’s why it pays to know how to install it on a system like Rocky Linux 8 which can be the gateway to many developers and sysadmin. So, today, you will learn how to install Git on Rocky Linux using two different methods.

What is Git?

Git is a version control tool that helps programmers keep track of changes being made to source code. It was initially developed by Linus Torvalds, which gives us an idea of the seriousness of the application.

The tool is open source, which allows us to examine it and learn more about how it works. 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.

Let’s get to it.

Installing Git on Rocky Linux 8

There are two ways to install Git on Rocky Linux. The first is to do it through the system repositories; the second is to compile the source code of the application ourselves and get the latest stable version. Choose the one that best suits your needs.

Method 1: Install Git from the official Rocky Linux 8 repositories

The first method is actually the easiest and most straightforward, as Git is present in the official Rocky Linux 8 repositories.

So, open a terminal or connect to your server and first, update it

sudo dnf update

Thereafter, you can install it with the command

sudo dnf install git

When the process is finished, you will have Git installed. You can verify the installed version by using the command.

git --version

Sample Output

git version 2.27.0

Then, Git is installed correctly.

Method 2: Install Git by compiling its source code

The above method is fairly easy to do, but doesn’t give you the latest stable version. If you want it, then the best thing to do is to compile the source code of the application.

To achieve this, first install all the tools for compiling code

sudo dnf install wget tar gettext-devel curl-devel expat-devel openssl-devel perl-CPAN perl-devel zlib-devel unzip cmake gcc make

After this, thanks to the wget command, download the latest stable version of Git, which is currently 2.36.0.


Then unzip it

tar xvzf git-2.36.0.tar.gz

Access the folder that has been generated

cd git-2.36.0

And start the compilation

sudo make prefix=/usr/local all

Then the installation

sudo make prefix=/usr/local install

Finally, check the installed version.

git --version

Configure Git on Rocky Linux 8

After it’s installed, we need to make a few small configurations that will make everything right.

First define a username

git config --global "[your-name]"

And then your email address

git config --global "[your-email]"

This way, we’ll have Git ready for work.


Git is a vital tool in application development and is one of the most popular tools we can think of. I hope this post has helped you to install it from two different methods that will give you more options for it.

Share this post, and thanks for reading.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top