Installing git from source

RHEL7/CentOS7 may use old versions of git. Here’s how to update (using git 2.33.1 as example). You might save some frustration by running “sudo yum remove git” first.

sudo yum -y install curl-devel zlib-devel
export GITVERSION=2.37.2
mkdir -p ~/src && cd ~/src
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-$GITVERSION.tar.gz
tar xf git-$GITVERSION.tar.gz
cd git-$GITVERSION
./configure
make
sudo make install
git --version

I had an issue once where the terminal needed to be restarted. I had removed yum’s git package and the shell was still looking for /bin/git for some reason. Starting a new terminal window fixed the issue. This happened in CentOS7.

1 thought on “Installing git from source”

  1. Pingback: Building Qt5 for CentOS 7 – GeoHub

Leave a Comment