I have an issue where I need to execute the following steps:

sudo apt-get update
sudo apt-get install build-essential fakeroot dpkg-dev libcurl4-openssl-dev
sudo apt-get build-dep git
mkdir ~/git-openssl
cd ~/git-openssl
apt-get source git
dpkg-source -x git_1.7.9.5-1.dsc
cd git-

For my Ubuntu 14.04 installation I upgraded git to version 2.10.2 but when I get to this step (sudo apt-get build-dep git) the git package version is 1.9.1. My question is simple. Is there a way to use the build-dep command to get version 2.10.2?

  • Never seen build-dep return what version of source it's getting the build dependencies for. If you installed git-2.10 as a proper debian package then apt-get build-dep would base off of that. If not then it would base off of the current 14.04 package (1.9.1) – doug Nov 3 '16 at 19:12
  • Not to discourage custom building, but if you're just using the release as is without modification, then there's a great ppa for the latest sudo add-apt-repository ppa:git-core/ppa – Jeff Puckett Nov 5 '16 at 16:30

You have to add the latest ppa with the --enable-source flag (source):

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

You can find my fork of the full script I used on my Ubuntu 14.04 server here:

#!/usr/bin/env bash

# Clear out all previous attempts
rm -rf "/tmp/source-git/"

# Add PPA for latest git
sudo add-apt-repository --enable-source ppa:git-core/ppa
sudo apt-get update

# Get the dependencies for git, then get openssl
sudo apt-get install build-essential fakeroot dpkg-dev -y
sudo apt-get build-dep git -y
sudo apt-get install libcurl4-openssl-dev -y
mkdir -p "/tmp/source-git/"
cd "/tmp/source-git/"
apt-get source git

# We need to actually go into the git source directory
# find -type f -name "*.dsc" -exec dpkg-source -x \{\} \;
cd $(find -mindepth 1 -maxdepth 1 -type d -name "git-*")

# This is where we actually change the library from one type to the other.
sed -i -- 's/libcurl4-gnutls-dev/libcurl4-openssl-dev/' ./debian/control
# Compile time, itself, is long. Skips the tests. Do so at your own peril.
sed -i -- '/TEST\s*=\s*test/d' ./debian/rules

# Build it.
dpkg-buildpackage -rfakeroot -b -uc -us

# Install
find .. -type f -name "git_*ubuntu*.deb" -exec sudo dpkg -i \{\} \;

I had previously installed git so the last command gave me an error about missing dependencies with liberror-perl, the following fixed it for me

sudo apt-get install liberror-perl
sudo apt-get -f install
find .. -type f -name "git_*ubuntu*.deb" -exec sudo dpkg -i \{\} \;

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.