• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How To Install Git on CentOS 8

Written by Admin, Updated On December 22, 2019
centos, git
How To Install Git on CentOS 8 Linux

Git is world’s most popular distributed version control system. It used to track changes, revert to previous stages, create branches for many open source and commercial projects. This guide will explains how to install Git on CentOS 8 Linux.

You can install Git using two methods either using yum package manager or you can Install Git from the Source for latest stable version.

Prerequisites#

Before start installation, you should logged in with non-root user account with sudo privileges.

Install Git using Yum#

The Git package is available in the CentOS’s default repositories. Run the below command to install Git using yum:

sudo yum install git

After that, you can verify the installation by checking version:

git --version
git version 2.18.1

You installed Git successfully and ready to use it.

Install Git from the Source

If you want to install latest stable version of Git then it good choice to install from the Source. After that, you will not able be to maintain your Git installation through the yum package manager.

At first, you should install the dependencies using below commands:

sudo yum groupinstall "Development Tools"
sudo yum install curl-devel expat-devel gettext-devel openssl-devel  perl-CPAN perl-devel zlib-devel

On completion of installation, visit Git’s mirror on GitHub and find the latest release link URL ending with .tar.gz extension:

installing-git-from-source

As per above image currently, the most recent stable Git version is 2.24.1. There might be change when you visit this link.

Common location to store the Git source is /usr/src directory. So go to that directory using below command:

cd /usr/src/

Type below command with last copied URL link to download latest tar.gz file of git.

sudo wget https://github.com/git/git/archive/v2.24.1.tar.gz

After that, extract the file put to the git source directory by typing:

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

Next, compile and install Git on your CentOS system using below commands:

sudo make prefix=/usr/local all
sudo make prefix=/usr/local install

That’s it. Git is installed successfully. You can verify it by typing:

git --version
git version 2.24.1

To update the version you should repeat the process of download and extract latest files.

Configure Git#

Now your Git is installed on your CentOS machine and you need to configure it by setting up email address and username:

git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"

Don’t forget to replace with your real name and email address.

You can check entered details by typing:

git config --list
user.name=Your Name
user.email=youremail@example.com

These settings are stored at ~/.gitconfig file and you can see content as below:

You can make other git configuration changes by using git config command or you can use text editor to make changes to ~/.gitconfig file manually.

Conclusion#

In this article, we show you multiple ways to install Git on your CentOS 8 system. If you would like to install latest stable version then you should install from Git source. You can get more details about use of Git from Pro Git book.

Feel free to comment below if any question or feedback.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article Linux Shutdown Command
Next Article   Linux Reboot (Restart) Command

Related Posts

  • How to Install Php 8 on CentOS 8

    How to Install PHP 8 on CentOS 8

    January 27, 2021
  • How to Install Python 3.9 on CentOS 8

    How to Install Python 3.9 on CentOS 8

    December 31, 2020
  • How to Install GIMP 2.10 on CentOS 8

    How to Install GIMP 2.10 on CentOS 8

    December 30, 2020

Leave a Reply Cancel reply

Popular Posts

© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook