Sometimes you might want to update your Git to latest version to benefit more features, right? I will show you how to install Git latest version on Linux.
Why would you want to update Git to latest version? Well, the answer is that it depends, if your current Git version already satisfies your needs, you don’t have to update. But in case your Git version is too old that you can’t do something cool with Git, ex. config each local git repository to use different private key file, which is only supported from Git v2.10.0+. So if you’d like to update your Git, this post is written for you.
Okay, so let’s get started.
First, navigate to the Git repository on Github, and determine the latest Git version, or the version you want to install, get the download link. At the time of writing this post, its latest version is 2.36.1, I will use command line to download to the Linux host.
$ wget https://github.com/git/git/archive/refs/tags/v2.36.1.tar.gz
Extract the tarball and get inside the directory:
$ tar xzvf v2.36.1.tar.gz $ cd v2.36.1
To be clear, what we download is the complete Git source code, and we will build it into executable binary for Linux, and that means we need to install build tools necessary for the job.
At this step, it depends on your Linux distros that you will use different commands to install the build tools. Please see below.
$ sudo apt install make autoconf zlib1g-dev gettext asciidoc xsltproc xmlto
$ sudo dnf install make autoconf gcc zlib-devel perl-devel asciidoc xmlto
$ sudo yum install make autoconf gcc zlib-devel perl-devel asciidoc xmlto
$ sudo pacman -S make autoconf asciidoc xmlto
After the build tools have been installed, you can execute each of following commands, one by one. You can grab a cup of coffee while doing this.
$ make configure $ ./configure --prefix=/usr $ make all doc $ sudo make install install-doc install-html
Once all commands have been executed successfully, confirm the Git version by issuing this command:
$ git --version git version 2.36.1
Congratulation, now you have Git latest version installed!
That’s how you install Git latest version on Linux. Good luck!