How can I update to a newer version of Git using apt-get?

  • I've just set up a new machine with Ubuntu Oneiric 11.10 and then run

    apt-get update
    apt-get upgrade
    apt-get install git

    Now if I run git --version it tells me I have git version but on my local machine I have the much newer git version

    I know I can install from source to get the newest version, but I thought that it was a good idea to use the package manager as much as possible to keep everything standardized.

    So is it possible to use apt-get to get a newer version of git, and what is the right way to do it?

  • Marco

    Marco Correct answer

    9 years ago

    You have several options:

    1. Either wait until the version you need is present in the repository you use.
    2. Compile your own version and create a deb.
    3. Find a repository that provides the version you need for your version of your distribution(e.g. Git PPA).
    4. If you don't need any particular feature from the newer version, stay with the old one.

    If a newer version is available in the repositories you use, then apt-get update && apt-get upgrade (as root) updates to the latest available version.

    For those who don't know what a PPA is, link

    +1 for the PPA. Otherwise compile from source and use checkinstall to cleanly install a .deb

    The OP specifically asked for using the package manager, so only #3 applies.

License under CC-BY-SA with attribution

Content dated before 6/26/2020 9:53 AM