How to Install Git on CentOS 8

How to Install Git on CentOS 8

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Git is a DevOps tool used for source code management. It is a free and open-source version control system used to handle small to very large projects efficiently. Git is used to tracking changes in the source code, enabling multiple developers to work together on non-linear development.

Git is not a programming language, but it’s become incredibly important for computer programmers working in almost any language you can name. Today, Git is the de facto standard for what’s known as version control software

Install git on CentOs8; Through this tutorial, we will learn how to install and configure git on CentOS 8.

Installing Git with Yum on CentOS 8

One of the simplest and easiest method to install Git is with a yum package manager, if we want to install the newest release of Git, consider compiling it from the source (instructions for compiling Git from the source are given further down below).

$ sudo yum install git

Once installed Git on centOS 8, We can verify the version of the installed Git by executing the following command on command line or terminal:

$ git --version

git version 2.18.1

Installing Git from Source Code on CentOS 8

If we want to feature 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, we will need the following necessary tools to build the binary from the source:

$ sudo yum groupinstall "Development Tools"
$ sudo yum install wget unzip gettext-devel openssl-devel perl-CPAN perl-devel zlib-devel libcurl-devel expat-devel

Once the above given commands are executed successfully, then 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 the following wget command:

$ sudo wget https://github.com/git/git/archive/v2.23.0.tar.gz -O git.tar.gz

After that, execute the following command on command line or terminal to move into the directory:

$ sudo tar -xf git.tar.gz
$ cd git-*

Then install and build Git from source using the following command:

$ sudo make prefix=/usr/local all install

Once compilation finishes, we can type the following command to verify the Git Version installation.

$ git --version

git version 2.23.0

Configuring Git

Now git is installed on the CentOS machine successfully, now we will need to set up our personal info which will be used when we commit any changes to our code.

$ git config --global user.name "Your Name"
$ git config --global user.email "[email protected]"

To verify that the above settings were added successfully, we can list all of the configuration settings that have been added by typing.

$ git config --list

user.name=Your Name
[email protected]

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.

Conclusion

That’s It! In this article, we have learned how to install Git on CentOS 8 server using yum and source code.

Recommended CentOS Tutorials

AuthorAdmin

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *