Since February 2020, a new-enough version of git
is available in Buster backports (2.30.2 since June 2021); to install that, run
sudo apt install -t buster-backports git
Readers who haven’t already enabled Buster backports will need to run
echo deb http://deb.debian.org/debian buster-backports main | sudo tee /etc/apt/sources.list.d/buster-backports.list
sudo apt update
first.
The rest of the answer is obsolete with respect to the actual question, but can be applied generally for other packages (at least, for the current release of Debian, which is no longer Buster).
To get version 2.24 or later, in the absence of a backport I recommended two approaches: ask for a backport, or build the 2.24 source package.
To ask for a backport, file a wishlist bug on git
using reportbug
. Backports have been made available in the past, so there’s a decent chance someone will provide one if you explain why you want it.
To build a newer package from source, run
sudo apt-get install devscripts dpkg-dev build-essential
sudo apt-get build-dep git
dget https://deb.debian.org/debian/pool/main/g/git/git_2.24.1-1.dsc
cd git-2.24.1
dpkg-buildpackage -us -uc
You can replace git_2.24.1-1.dsc
and git-2.24.1
with whatever is appropriate for the version you wish to install; see the Debian package tracker to find out which versions are available as source packages.
This will install the necessary build dependencies and build the packages. You can then install the ones you need using sudo dpkg -i
.
It’s not worth upgrading all your distribution to testing, just to get a newer version of git
...