How to install Git on CentOS 9 Stream?

Git is one of the most important tools in application development today. Today, you’ll learn how to install Git on a system like CentOS 9 Stream. I’ll also talk you through it and get you up and running.

What is Git?

According to Wikipedia

Git is a version control software designed by Linus Torvalds, thinking about the efficiency, reliability and compatibility of maintaining versions of applications when they have a large number of source code files.

Git stores and manages information very differently from those other systems such as Subversion and Perforce, even though its user interface is quite similar. As you can see, Git is a necessary element if you want to develop quality applications with specific control over changes and therefore versions.

It is not an exaggeration to think that Git is one of the most essential tools at the software level today. Because it allows you to make modifications to the code and makes it easier to manage the different versions of each developed product. That is why many developers use it daily.

Some features of Git are:

  • Fast branch management.
  • Efficient management of large projects.
  • Distributed management.
  • Low resource consumption.
  • Open source and cross-platform

So as you can see, it is quite efficient and useful to use.

Install Git on CentOS 9 Stream

Git is such a popular tool that it is present in the official repositories of many Linux distributions. And of course, CentOS 9 Stream is no exception. So, open a terminal and then, update the whole system

sudo dnf update

Thereafter, you can search for the git package to get additional information about it.

sudo dnf info git
Install Git on CentOS 9 Stream
Install Git on CentOS 9 Stream

And you will see information about this package. Now all that’s left is to install it.

sudo dnf install git

This will start the whole process and when you are done, you can verify the version you have installed.

git --version

Optional: Get the latest stable version of git

If you want to have the latest stable version of git, a good way is to compile the git source code.

To achieve this, you first have to install some necessary packages:

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

Next, download the source code for the latest stable version of git.

wget -c https://www.kernel.org/pub/software/scm/git/git-2.37.0.tar.gz

Then unzip this file

tar -xvzf git-2.37.0.tar.gz

Access the folder and compile the code inside it

cd git-2.37.0
sudo make prefix=/usr/local all

Now install it

sudo make prefix=/usr/local install

Thereafter, check the Git version.

git --version

Sample Output:

git version 2.37.0

Configure Git before using it

Before using Git, you have to configure your user with this command:

git config --global user.name "NAME"

And then, your email:

git config --global user.email "EMAIL"

Verify the configured data with the following command:

git config --list

And then I’m done.

Conclusion

In this post, you learned how to install Git on CentOS 9 Stream. This is one of the most important applications for developing modern applications and manage the versions of this software.

Leave a Comment

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

Scroll to Top