How to Install & Configure Git on AlmaLinux 8

Git is a mature, actively maintained open source project initially developed in 2005 by Linus Torvalds, the famous Linux operating system kernel creator. Git is designed for developers that need a pretty straightforward version control system. Most software is collaborative efforts and sometimes can have hundreds of people with commits working on software development projects. It is essential to track these commits customarily done in branches in most projects before being merged into the master for release. It is easy to review and track down any incorrect commits and revert, leading to a much easier development if anything goes wrong.

In the following tutorial, you will learn how to install Git on AlmaLinux 8 in various methods.


  • Recommended OS: AlmaLinux 8.
  • User account: A user account with sudo privilages or root access (su command).

Updating Operating System

Update your AlmaLinux operating system to make sure all existing packages are up to date:

sudo dnf upgrade --refresh -y

The tutorial will be using the sudo command and assuming you have sudo status.

To verify sudo status on your account:

sudo whoami

Example output showing sudo status:

[joshua@localhost ~]$ sudo whoami

To set up an existing or new sudo account, visit our tutorial on How to Add a User to Sudoers on AlmaLinux.

To use the root account, use the following command with the root password to log in.


Method 1. Install Git from Appstream

By default, Git is available in the App stream repository and installed using the DNF package manager. To do this, use the following command:

sudo dnf install git

Example of dependencies that will be installed:

How to Install & Configure Git on AlmaLinux 8

Type “Y,” then press “ENTER KEY” to proceed with the installation.

Once installed, verify the installation:

git --version

Example output:

git version 2.27.0

Congratulations, you have installed Git on Almalinux 8 using the dnf manager method.

Method 2. Compile & Install Git from Source

The tutorial has covered installing from the App stream. However, for those wanting the absolute latest Git version, it’s recommended to always install from the source. However, it is a bit more time-consuming but will always leave you with the newest version available.

As with unstable, you will need to make sure any security issues are monitored; with the source, you can quickly re-compile any urgent updates making this the better option for anyone needing to use the latest Git.

Before starting the installation from the source, use the su command to log into the root account for this installation.

To begin with, install the Git dependencies as follows:

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

Next, visit the release page to find the master zip archive or the latest stable release from Git.

When writing the guide, 3.3.1 is the latest stable release, but this changes often, so make sure to get the latest version.

In your terminal window, use the wget command as below:


Use the wget command to get the latest development version (master):

wget -O

Note, do not use this version unless as it will be unstable and possibly contain bugs.

Next, Unzip which archive you downloaded:


sudo unzip

Now you will need to navigate to the directory using the CD command:

cd git-2.33.1

You now need to run the following make commands to install git:

First command:

sudo make prefix=/usr/local all

Note, this will take a few minutes, depending on your system’s performance capabilities.

Second command:

sudo make prefix=/usr/local install

Now that you have installed Git from the source, verify the installation and build:

git --version

Example output:

git version 2.33.1

Congratulations, you have installed Git on Almalinux 8 using the compile method.


How to Configure Git

After installation, you will need to set up standard settings such as names and e-mails, mainly around git commit messages. This is pretty straight forward as the tutorial will explain below.

The first step is to provide your name that will be set Globally:

git config --global "YOUR NAME"


git config --global "Joshua"

Next, select your e-mail; this can fake if you prefer:

git config --global "YOUR EMAIL"


git config --global ""

To confirm these have been added, use the config –list command:

git config --list

Example below:

How to Install & Configure Git on AlmaLinux 8

Unless specified, Git stores details in the ~/.gitconfig file. You can review what is currently stored by using the cat command:

cat ~/.gitconfig

Example below:

How to Install & Configure Git on AlmaLinux 8

Note, using the sudo command with the git config command will set two separate user names and e-mails.

You can store this information for quicker access in the future; note this is for dedicated servers being run by 1 or 2 people that are trustworthy as the information isn’t stored securely or encrypted and is just in text form, so any users that have access to the server can easily read this.

git config --global credential.helper cache

If you must use credential helper, it is advised to cache only for a limited time for increased security. For example, you will be working today using git for 1 to 4 hours but won’t be touching it for maybe a few weeks, then set expiry for 5 hours:

git config --global credential.helper "cache --timeout=18000"

After 5 hours, the credentials will be deleted. This secures your GIT.

Comments and Conclusion

Git is a fantastic piece of software for software developers and sysadmins. Web server owners can track changes on specific directories when developing your servers or website, and the ability to quickly revert should not be looked over. Git is not the most accessible software to work. However, it works well for what it is designed for.

Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x