Hello Techies, Ashish on the behalf of Tastethelinux, will present “how to install GIT on Rocky Linux 8.”
What is GIT?
GIT is the Version control system used to manage the source code of an application. GIT is where many developers can work on the same source code with the Sync.
The main advantages of the GIT are that we can merge the source codes, revert the code, also we can manage the different version controls.
Install GIT on Rocky Linux 8 ec2 AWS.
We will use two ways to Install Git in Rocky Linux. Both the ways are a little bit different from one another.
- Install GIT on Rocky Linux ec2 AWS via the command line.
- Install GIT on Rocky Linux ec2 AWS via Source Code.
How to Install GIT on Rocky Linux ec2 AWS via Command Line.
Let’s update the repositories on Rocky linux first, and then we will install GIT.
$ sudo dnf update -y
After updating the repositories, we will use the dnf command for the installation.
$ sudo dnf install git -y
So the above command will download the GIT with its dependencies packages and install all the required packages for GIT.
Once installed, we will check the version for the GIT, by using the git command on the terminal.
$ git --version OUTPUT: git version 2.27.0
The Output “git version 2.27.0” is the git version installed via “dnf command”, let’s install via Source Code
How to Install GIT on Rocky Linux ec2 AWS via Source Code.
So let’s install git via source code then we have to download the git source from GitHub, but before that, we have to install some of the dependencies.
$ sudo dnf install gettext-devel openssl-devel perl-CPAN perl-devel zlib-devel gcc autoconf -y
So, we have downloaded some library packages, now download the git source code via the wget command
So, first I visit to https://github.com/git/git/releases and right click on the tar.gz and select the “Copy link address”.
Then copied link will be used with the wget command to download the GIT source file.
$ wget https://github.com/git/git/archive/refs/tags/v2.32.0.tar.gz
Once the source code gets download then we will extract the source code via the tar command.
$ tar -zxvf v2.32.0.tar.gz
So after that extract, the package. Now go into the folder, and compile the package.
$ cd git-*
$ sudo make prefix=/usr/local all
Once we have done the compilation successfully, we will install all the packages.
$ sudo make prefix=/usr/local install
After that just create a soft link to use the GIT command, if not created it will give the error “git command not found”
$ sudo ln -s /usr/local/bin/git /usr/bin/git
After creating the soft link will check the version for the GIT.
$ git --version OUTPUT: git version 2.32.0
Configure GIT on the Local System.
To configure GIT on the local system, we will use the config option with the git command.
$ git config --global user.name "tastethelinux"
So we have configured the username for the git, now configure the user email ID with the parameter “user.email”.
$ git config --global user.email "[email protected]"
By using the –list option, you can check the configured user name and email ID.
$ git config --list OUTPUT: user.name=tastethelinux [email protected]
You can configure and then take the clone of your repository and use the GIT. Comment to me in the comment section if you face any difficulties.