Hamsa K
4 min read | 10 months ago

How to Install Git 2 23 on Centos 7

How to install git 2.23 on Centos 7

Git is the most popular version control system that’s being used by hundreds of thousands of projects. Git allows you to keep track of your code changes, revert to previous stages, work simultaneously on multiple branches.It is designed to handle a small to very large projects with speed and efficiency.

Method 1:

This is the easy way to install through yum.For this first we need to enable IUS repository or Wandisco GIT Repository

vi /etc/yum.repos.d/wandisco-git.repo

Add below content to above file.

name=Wandisco GIT Repository

save the file. then Import the repository GPG keys with below command

rpm --import http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco

Once the repository is added, to install the latest version of Git run the following command

yum install git

Now you can check git version using the command 'git --version'

Method 2:

Compiling from source code

If you want to compile latest version of git from source code then follow below steps.


yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

After installing above packages download lastest version of git from this url

cd /usr/src
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.23.0.tar.gz
tar -xvzf git-2.23.0.tar.gz

After downloading and extracting Git source code, Use the following command to compile the source code.

cd git-2.23.0/
./configure --prefix=/usr/local/git
make install

Setup environment

Now you just need to set binary in the system environment.

echo "export PATH=/usr/local/git/bin:$PATH" >> /etc/bashrc
source /etc/bashrc
git --version

sample output:

git version 2.23.0

Configuring Git

Now that you have Git installed it is a good idea to set up your personal information that will be used when you commit changes to your code

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

sample output:

user.name=Your Name

That's it.Git has been successfully installed on your system.



Warning! This site uses cookies
By continuing to browse the site, you are agreeing to our use of cookies. Read our terms and privacy policy