If I run the following command on Debian Lenny:

apt-get install git

... I'm unable to use git:

# git --version
bash: git: command not found

2 Answers 2


The package you most likely want is git-core.

(Works just fine without adding an extra repository.)

Update: This has now been fixed; in squeeze and beyond the git package is now called git.

  • Aha, that's a much easier approach. Thanks. I'm surprised that the Debian site didn't make this more clear. Oh well, that's Debian for you I guess. Jul 4, 2010 at 12:08
  • However, with this approach you only get git version Jul 4, 2010 at 15:31
  • Yes, that seems to be the version of the dvcs git being provided in lenny. So if you really need/want a newer version, there is still a benefit in going for the backports.
    – andol
    Jul 4, 2010 at 15:45
  • Will still mark yours as the valid answer, since it's less complicated! ;-) Jul 4, 2010 at 16:27

To get ~1.7.1 use this method. If you want ~ then use andol's answer.

This is because git is a dummy package in Lenny which provides gnuit.

However, you can get around this by using the lenny-backports git package:

UPDATE: As of September 5th 2010, this method has changed slightly as backports.org is being phased out the instructions now follow the recommended solution to install from the latest Debian backports.

  1. Add this line:

    deb http://archive.debian.org/debian-backports/ lenny-backports main contrib non-free

    to your /etc/apt/sources.list.

  2. Run: apt-get update.
    If you get get a security warning about NO_PUBKEY AED4B06F473041FA, run step 3, 4 and 5 -- if not, skip to step 6.

    Run: gpg --keyserver pgp.mit.edu --recv-keys AED4B06F473041FA

    Run: gpg --armor --export AED4B06F473041FA| apt-key add -

    Run: apt-get update again to confirm.

    Note, adding the debian-backport-keyring is no longer necessary.

  3. Run: apt-get -t lenny-backports install git

  4. Run: git --version

    git version
  • When executing the 2nd gpg line, I got "gpg: can't open `/etc/apt/trusted.gpg'" and then an error. I fixed this by su'ing instead of sudo'ing. Then apt-get -t lenny-backports install git persists in claiming that is the latest version of git. I fixed this by replacing your recommended sources.list line with deb archive.debian.org/debian-backports lenny-backports main contrib non-free. Then all was well. Don't want to edit your answer, because I don't actually know what I'm doing. Just thought I'd share what worked for me.
    – acjay
    Sep 7, 2012 at 9:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.