10

I'm trying to get the most recent version of Git installed onto my Debian Buster machine, and I'm running into trouble. The most recent version of Git on stable is 2.20. I found that the testing branch has the right version, but I'm not having any success with backports. I've added

deb http://deb.debian.org/debian/ buster-backports main contrib
deb-src http://deb.debian.org/debian/ buster-backports main contrib

to /etc/apt/sources.list and done sudo apt-get update, but every time I run sudo apt-get -t buster-backports install git I end up with 2.20 again. I've also tried using apt-get to remove git and then install it, but no luck. Any advice?

Thanks!

0

3 Answers 3

15

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...

0
6

You first need to check if the package is available in buster-backports. As you can see on Debian Packages, git is not available in backported packages. Not much time has been passed since the release of the latest stable release of Debian (Buster), so you might expect that there will not be so-many packages in the buster-backports. You can check the following for further details:

One way to install another version of git would be to compile it from the source, but in that case you need to solve dependencies and maintain the updates yourself. Detailed instructions can be found in: https://github.com/git/git/blob/master/INSTALL

Note that if you are new to Linux, or not confident with your Linux skills, I would not recommend doing that as you can easily mess up your dependencies.

1
  • Now it is there as Alexandr wrote in his answer.
    – Timo
    Commented May 19, 2021 at 18:49
2
sudo apt-get -t buster-backports install git
2
  • this only works if you already add buster-backports to your list of sources
    – Batavia
    Commented Sep 2, 2020 at 9:30
  • Put this in your /etc/apt/sources.list: deb http://deb.debian.org/debian buster-backports main
    – Timo
    Commented May 19, 2021 at 18:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .