clubmate.fi

A good[ish] website

Web development blog, loads of UI and JavaScript topics

How to install the latest version of Git on an Ubuntu box

Filed under: Server— Tagged with: git

Here’s a short memo on how to tell apt-get about a new Git version.

Install or update via apt-get

Check if Git is installed and what version it’s on:

$ git --version
git version 1.7.9.5

Ideally you would just go:

$ sudo apt-get install git

The Git version in apt-get is stuck to 1.7.9.5, that might be okay in most cases, but if you want the latest 2.3.4 (at the time of writing this), you need to add the latest Git to apt-get with the following command:

$ sudo add-apt-repository ppa:git-core/ppa

The repo is maintained by these people.

Now apt-get knows about the new Git, then install it:

# First update the apt-get package database
$ sudo apt-get update

# Then install git
$ sudo apt-get install git

Check version and do a little dance:

$ git --version
git version 2.3.4

Troubleshooting

If you get an error like:

sudo: add-apt-repository: command not found

Then you need to install the software-properties-common package:

$ sudo apt-get install software-properties-common python-software-properties

Comments would go here, but the commenting system isn’t ready yet, sorry. Tweet me @hiljaa if you want to make a correction etc.

  • © 2021 Antti Hiljá
  • About
  • Follow me in Twatter → @hiljaa
  • All rights reserved yadda yadda.
  • I can put just about anything here, no one reads the footer anyways.
  • console.log('Smash the patriarchy!')
  • I love u!