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 Ibmi Media, we shall look into how to install Git on RockyLinux 8.
Different ways of installing Git on Rocky Linux
- Git installation from the AppStream.
- Git installation from Source.
a. Git installation from the AppStream
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.
b. Git installation from Source
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
How to confirm Git installation ?
You can Check the version of git installed with the command:
$ git --version
How to Set up Git ?
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
[Need help in fixing Rocky Linux system issues ? We can help you. ]