Git is a software used as a distributed version control system. It is best used to keep track of team code changes, create branches, revert to previous versions and collaborate with other developers in the same team and other teams.
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 Git 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 to build
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.
Related Posts
If you have any questions, please contact me at arulbOsutkNiqlzziyties@gNqmaizl.bkcom. You can also post questions in our Facebook group. Thank you.