32

I am trying to set up Git on an Ubuntu Machine (I'm using a Samsung Chromebook running Ubuntu 12.04).

When I entered "sudo apt-get install git" and it successfully installed Git 1.79

user@ChrUbuntu:~$ git --version
git version 1.7.9.5

I can't figure out what I am doing wrong here. Any suggestions?

Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
Vincent
  • 1,454
  • 2
  • 17
  • 24

6 Answers6

108

For new installations of Ubuntu I would first try this to get the latest updates

sudo apt-get dist-upgrade

For more info on this see https://askubuntu.com/questions/81585/what-is-dist-upgrade-and-why-does-it-upgrade-more-than-upgrade

That should solve it but if not, add the repository from these guys https://launchpad.net/~git-core/+archive/ppa

sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git

This way you don't have to build it, etc.

Community
  • 1
  • 1
haley
  • 1,573
  • 2
  • 12
  • 19
  • 4
    I'd rather apt-get than compile any day. – Yonatan Nov 13 '13 at 07:35
  • As a good complement, you might need this: http://stackoverflow.com/questions/17797328/why-is-the-git-subtree-not-working-even-though-i-have-git-1-8-3-2-installed-on – fbiville Mar 14 '14 at 22:43
21

Perhaps you need to build for the newest version

wget git-core.googlecode.com/files/git-1.8.1.1.tar.gz
tar -zxf git-1.8.1.1.tar.gz
cd git-1.8.1.1
make prefix=/usr/local all
sudo make prefix=/usr/local install
Zombo
  • 1
  • 62
  • 391
  • 407
  • tried ersion 1.8.5.5, doesn't work for me... `done && \ ./check_bindir "z$bindir" "z$execdir" "$bindir/git-add"` is the last line... – spankmaster79 Jun 02 '14 at 19:44
5

If you are trying to upgrade to the latest version of Git, you should do:

sudo apt-get update
sudo apt-get upgrade

This will update all your packages, as well as Git.
BTW, latest version of Git on my Kubuntu 12.10 is 1.7.10.4.

Omid Kamangar
  • 5,768
  • 9
  • 40
  • 69
  • 4
    This will most likely not get you the latest version. The Ubuntu repositories are always behind. You should add the PPA from the "Ubuntu Git Maintainers" team, see @haley's answer. – Dennis Sep 28 '13 at 07:23
1

A combination of some of the answers worked for me. I did...

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

sudo apt-get update

sudo apt-get upgrade

Harish Garg
  • 53
  • 11
0

Have you tried to do an apt-get update? You might have an outdated package list.

Jan Segre
  • 574
  • 5
  • 12
0

In ubuntu 14.04 I tried the terminal code:

sudo apt-get update
sudo apt-get upgrade

step to upgrade git.

1.) git --version
*to know what git version you had in your computer

2.) sudo apt-get update
*update ubuntu

3.) sudo apt-get upgrade
*to upgrade software including git

4.) try to git --version

that's it :)

Kuya A
  • 351
  • 2
  • 18