Git : one of the most popular decentralized version control tools used by developers to coordinate the work amongst them. Designed by Linus Torvalds ( the creator of Linux Kernel.) in the year 2005.
The version control tool helps you to recover the lost file very easily. If a mistake made by anyone from the team, one can look back and compare the earlier version of the file and fix the mistake or any conflict.
Version Control System tool plays a vital role in today’s modern Software development. Version control is a software that helps a group of software developers work together and manage the history of the work. It does not overwrite other’s changes, therefore you can keep track of every change, revert the file or a project to its previous state.
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.
Installing Git with Yum on CentOS 8
One of the simplest and easiest ways to install Git is with a yum package manager, but the available version may be older than the newest version available. If you want to install the newest release of Git, consider compiling it from source (instructions for compiling Git from the source given further down below).
# yum install git
Once installed git, you can verify the version of installed Git using the following command.
# git --version
Installing Git from Source Code
If you want to feature by a specific version of Git or need flexibility in installation then one of the best methods is to gather the software Git from Source. However, it will not manage and update Git installation through the yum package manager but will allow you to install the latest version of Git and customize the build options. This method is a bit lengthy process.
Before we move forward with the installation, you will need the following necessary tools to build the binary from the source.
# yum groupinstall "Development Tools" -y
Then install some important packages :
# yum install wget unzip gettext-devel openssl-devel perl-CPAN perl-devel zlib-devel libcurl-devel expat-devel
Once the tools installed successfully, open any browser and visit Gits project’s mirror on GitHub Release. The one at the top is the latest version of Git, but it may vary at your end. Now, look at the version you require then right-click the source code (tar.gz) and copy the link to download using following wget command as shown.
# wget https://github.com/git/git/archive/v2.27.0.tar.gz -O git.tar.gz
Once the download completed unzip the source package using tar command, now move into the directory.
# tar -xf git.tar.gz # cd git-2.27.0/ # make prefix=/usr/local all install
Once compilation finishes, you can type the following command to verify the Git Version installation.
# git --version
Now git is installed on the CentOS machine successfully, now you will need to set up your personal info which will be used when you commit any changes to your code.
$ git config --global user.name "Your Name" $ git config --global user.email "email@example.com"
To verify that the above settings were added successfully, you can list all of the configuration settings that have been added by typing.
$ git config --list
The above settings are stored in the global configuration ~/.gitconfig file. To make any additional changes to this file, use git config command or edit the file manually.
That’s It! In this article, we have explained how to install Git on CentOS 8 server using yum and source code. To learn more about Git