What and why?
Git is a software used for version control. The Raspberry Pi OS comes with an old version of git, version 2.20.1. If you want to install the latest version of git, version 2.32.0, read on.
Current version
First, check the version of git that you currently have on your Raspberry Pi.
git --version
You should get something like this:
git version 2.20.1
The latest git version is 2.32.0.
Install the pre-requisites
First, install the pre-requisites. The second step may take several minutes.
sudo apt update
sudo apt install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext
Download git source
cd /tmp/
wget https://github.com/git/git/archive/refs/tags/v2.32.0.tar.gz
tar -xzvf v2.32.0.tar.gz
cd git-2.32.0/
Now, make and make install. This may take several minutes.
make configure
./configure --prefix=/usr/local
make all
sudo make install
That would have installed the latest version of git. Let us test the version of git.
git --version
We should get this output:
git version 2.32.0
Let me know whether these steps worked for you. These steps worked successfully on a Raspberry Pi 3B.
{ % include 'ajrwd' %}