How to Install Git on Rocky Linux 8

Install Git on Rocky Linux 8

In this article, we will have explained the necessary steps to install Git on Rocky Linux 8. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Git is a distributed version control system, which you can use to track the code changes (versions) while developing software. Git offers features like data assurance, workflows, create branches, revert to the previous stage, incredible speed, keep track of your code changes, view logs, and many more. It allows you to perform your work in offline mode and when ready, you need the internet connection to publish the changes and take the latest changes.

Install Git on Rocky Linux 8

Step 1. First, before you start installing any package on your Rocky Linux server, we always recommend making sure that all system packages are updated.

sudo dnf install epel-release
sudo dnf update
sudo dnf upgrade
sudo dnf install gettext-devel curl-devel expat-devel openssl-devel perl-CPAN perl-devel zlib-devel unzip cmake gcc make -y

Step 2. Install Git on the Rocky Linux system.

  • Install Git on Rocky Linux via App stream repository.

Git is available in the App stream repository, we will use dnf command for the installation:

sudo dnf install git

Once installed, we will check the version for Git, by using the git command below on your terminal:

git --version

Result:

git version 2.27.0
  • Install Git on Rocky Linux via Source Code.

We have to download the git source from the GitHub website:

wget https://github.com/git/git/archive/refs/tags/v2.33.0.zip

Next, extracting source code:

sudo unzip v2.33.0.zip

Now go into the folder, and compile the package:

cd git-2.33.0
sudo make prefix=/usr/local all
sudo make prefix=/usr/local install

Verify Git the installation:

git --version

Result:

git version 2.33.0

Step 3. Configuring Git.

Now set up your personal info which will be used when you commit any changes to your code:

git config --global user.name "ardila_putri"
git config --global user.email "[email protected]"

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

git config --list

That’s all you need to do to install Git on Rocky Linux 8. I hope you find this quick tip helpful. For further reading on Git, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.