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.
This is the easy way to install through yum.For this first we need to enable IUS repository or Wandisco GIT Repository
Add below content to above file.
[wandisco-git] name=Wandisco GIT Repository baseurl=http://opensource.wandisco.com/centos/7/git/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco
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'
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 make install
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
git version 2.23.0
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 "firstname.lastname@example.org" git config --list
user.name=Your Name email@example.com
That's it.Git has been successfully installed on your system.