Git is a popular version control system used in modern software development. It allows multiple developers to contribute to the same project at the same time while tracking changes, revisions, and contributions. It helps with managing large projects efficiently. Git repositories are hosted on sites like Github and Bitbucket.
Here at LinuxAPT, we shall look into how to install Git on RockyLinux 8.
Git is available in Rocky Linux default repositories. The simplest option is to install git from the App stream default repository. The version in the default repository, however, may not be the latest release of git. You should compile and build git from source to obtain the latest version.
To install git via appstream run the below command:
$ sudo dnf install git
Then, type y and press enter to proceed with the git installation.
If you wish to install the most recent release of Git you need to compile and build it from source. This will not be maintained by your package manager. First, install the essential Git requirements for RockyLinux 8. Execute the command:
$ sudo dnf install gettext-devel curl-devel expat-devel openssl-devel perl-CPAN perl-devel zlib-devel unzip cmake gcc make -y
Then, download the latest release of Git from the official site. At the time of writing this guide, version 2.34.1 is the latest stable release. Run the following wget command:
$ wget https://github.com/git/git/archive/refs/tags/v2.34.1.zip
Next, extract the contents of the git archive file:
$ sudo unzip v2.34.1.zip
Then, navigate into the directory:
$ cd git-2.34.1
Now, execute the commands below to install git:
$ sudo make prefix=/usr/local all
$ sudo make prefix=/usr/local install
You can Check the version of git installed with the command:
$ git --version
Here, we will configure git so that your commit messages contain the correct information. Use the git config command to configure git for the first time. Provide your name and email address as follows:
First, set up your username globally:
$ git config --global user.name "YOUR-NAME"
Similarly, configure your email:
$ git config --global user.email "YOUR-EMAIL"
To verify that your name and email have been configured:
$ git config --list
This article covers how to install and configure Git on Rocky Linux 8. In fact, Git is popular version control system designed to handle very large projects with speed and efficiency; it is used for many high profile open source projects, most notably the Linux kernel.
How To Uninstall git on Ubuntu 21.04 ?
To uninstall only the git package we can use the following command:
$ sudo apt-get remove git
We can use the following command to remove git configurations, data and all of its dependencies, we can use the following command:
$ sudo apt-get -y autoremove --purge git