12

I have some problems with git-lfs and I think that upgrading to the latest git can fix this problems. Current version of git in Debian is 2.1.4, current stable version on official site is 2.6.4. Can I only build from source or maybe can I add some external repository?

  • similar question : unix.stackexchange.com/questions/33617/… – Ijaz Ahmad Khan Dec 29 '15 at 4:01
  • 1
    Installing from source is a procedure that can vary from application to application. In Git's case, the default install from source (at time of writing) is actually to the user's home directory: see its INSTALL file. So, such an install should be fairly painless to back out from if for some reason it doesn't work for you, especially if you take a system snapshot/backup beforehand. – sampablokuper Apr 2 '18 at 15:58
10

As of December 2015, Debian stretch/sid has git version 2.6.4. If you don't want to upgrade your entire distribution, you can look into apt pinning to bring in only git and any necessary dependencies from stretch/sid. However, many Debian folks will tell you this sort of thing is a bad idea, so building from source or waiting/asking for a backport are the only officially recommended approaches.

  • 3
    Thank you, I added to the /etc/apt/sources.list line deb http://ftp.us.debian.org/debian testing main contrib non-free and after this sudo apt-get update and sudo apt-get install git/testing. – Vitaly Zdanevich Dec 29 '15 at 14:29
7

Backporting git from Debian testing, unstable, or experimental is fairly trivial. See How can I install more recent versions of software than what Debian provides?. Something as simple as apt-get source -t unstable git, followed up debuild -uc -us inside the source directory should work. Note that these two commands should be run as user, not root.

You might have to install some build dependencies, though. apt-get build-dep git will probably work in that case. Note that this command is run as root, not user.

Please comment if you are trying to do this and need more details.

5

This worked on a Debian docker container(php:5-apache).

NOTE: This currently(Mar 2018) doesn't work with an error of libc6-dev dependencies.

 RUN echo "deb http://ftp.us.debian.org/debian testing main contrib non-free" >> /etc/apt/sources.list \
         &&      apt-get update              \
         &&      apt-get install -y git      \
         &&      apt-get clean all
1

This might help:

$ sudo add-apt-repository ppa:git-core/ppa
$ sudo apt-get update
$ sudo apt-get install git  
  • 3
    I am getting 404 from this repo at update – Vitaly Zdanevich Dec 29 '15 at 14:08
  • 3
    ppa works only on Ubuntu not Debian. Please see my answer. – kujiy Mar 10 '17 at 10:05
1

What Svetlin Tonchev suggested would work out of the box only if OP was using Ubuntu, which isn't the case here. However, when running add-apt-repository the added source will depend on the name of your OS. For example, if you go to /etc/apt/sources.list.d/ you might find a file called git-core-ppa-jessie.list (or similar) containing the following lines:

deb http://ppa.launchpad.net/git-core/ppa/ubuntu jessie main

deb-src http://ppa.launchpad.net/git-core/ppa/ubuntu jessie main

However, such repository does not exist and that's why OP got a 404.

A possible solution to this specific issue would be to manually edit the above file and replace jessie with xenial.

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.