Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Install Git From Source on Ubuntu

A complete Ubuntu guide to compiling Git from source, including core and documentation dependencies, the upstream build sequence, prefix behavior, Ubuntu package differences, and version-path verification.
Length8 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To install an upstream Git release on Ubuntu, install the documented build dependencies, obtain a tagged Git source tarball, then run make configure, ./configure --prefix=/usr, and the appropriate make and sudo make install targets. Build the documentation targets only if you need Git’s man pages, HTML documentation, and info files.

Source installation makes sense when Ubuntu’s repository version is older than the upstream release or when you need a controlled custom build. Ubuntu’s package remains the easier default for most systems because it integrates with distribution updates and security maintenance.

As an Amazon Associate I earn from qualifying purchases.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When installing Git from source is the right choice

The Git project describes the distribution package as the easiest Linux installation method. A source build is useful when you need a newer upstream release, want to choose the installation prefix, or need a repeatable build tailored to your environment.

Version differences are normal. The Git Linux installation page showed upstream Git 2.56.0 in the 2026 page state used for this guide, while the Ubuntu Noble package index listed Git source package version 1:2.43.0-1ubuntu7.3. Those figures belong to different release channels and dates; an Ubuntu installation can therefore lag behind upstream without being broken.

#1 Best Overall
Choose the Ubuntu package when… Choose a source build when…
You value the shortest installation and normal Ubuntu integration. You need an upstream release newer than the package in your Ubuntu release.
Distribution security updates and package tracking are more important than release timing. You need a controlled prefix or a custom build process.
You do not need to compile or maintain software locally. You are prepared to repeat the build when a newer Git release arrives.

Scott Chacon and Ben Straub summarize the reason to compile Git yourself in Pro Git: “Some people may instead find it useful to install Git from source, because you’ll get the most recent version.”

Install the build dependencies

Run the package update first, then install the core Debian/Ubuntu dependencies documented for building Git:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo apt-get update
sudo apt-get install dh-autoreconf libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev

These packages provide the development headers, libraries, tools, and configuration support needed by the standard Git build. Install them before running make configure; otherwise configuration or compilation can stop when a required library cannot be found.

Dependencies for the documentation targets

A binary-only build does not need the documentation-generation packages. Add them when you intend to run make doc info and install the generated documentation:

sudo apt-get install asciidoc xmlto docbook2x install-info
Build goal Packages to install Targets involved
Git binaries only dh-autoreconf, libcurl4-gnutls-dev, libexpat1-dev, gettext, libz-dev, libssl-dev make all, then the binary installation target
Binaries plus man pages, HTML, and info output All core packages, plus asciidoc, xmlto, docbook2x, and install-info make all doc info, then install-doc install-html install-info

The additional packages are not a recommendation to install every possible documentation tool by default. Keep them out of a minimal binary-only build unless you actually need the generated documentation.

Obtain an upstream Git source release

Use a tagged release tarball

The canonical upstream workflow starts with a tagged release tarball from kernel.org or the GitHub mirror. Download the version you intend to install, extract it, and change into the resulting directory. The directory name normally follows the git-<version> pattern.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
cd git-<version>

Use the archive’s actual directory name in place of <version>. You can extract the archive with your desktop archive manager or the standard command-line tools available on Ubuntu; the important requirement is that the working directory contains the Git source tree before you start the configure step.

Clone the upstream repository instead

If you need the development repository rather than a released archive, Git’s installation instructions show this repository URL:

git clone https://git.kernel.org/pub/scm/git/git.git

A repository checkout is a different starting point from a stable release tarball. For a predictable production installation, prefer a tagged release and record the tag or archive version used. A checkout is more appropriate when you intentionally need a particular development revision.

Build and install Git from the source tree

The following sequence mirrors the upstream build flow. Run it from the extracted Git source directory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Generate the configure script

    make configure

    This prepares the project’s configure script. If this command reports a missing build prerequisite, resolve that prerequisite before continuing rather than skipping configuration.

  2. Configure the installation prefix

    ./configure --prefix=/usr

    The --prefix=/usr option places the compiled Git installation in the standard system prefix used by the documented command sequence. Because writing there requires administrator privileges, compilation itself can run as your normal user, while the installation step uses sudo.

  3. Compile the binaries

    For a minimal installation that does not generate documentation, build the main targets:

    make all

    If you also installed the documentation dependencies and want every documented output, use the combined command instead:

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
    make all doc info

    Keep the source tree and build output until you have verified the installation. They make it easier to inspect a failure and repeat the same build.

  4. Install a binary-only build

    After make all completes successfully, install the compiled Git files into the configured prefix:

    sudo make install
  5. Install Git and its generated documentation

    When you built with make all doc info, install the binaries and all three documentation outputs:

    sudo make install install-doc install-html install-info

    The extra targets install the generated documentation alongside Git. They are only appropriate when the documentation build completed successfully.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What the installation prefix means on Ubuntu

The configure command’s --prefix=/usr setting determines where the source-built files are installed. It also affects which executable your shell finds when more than one Git installation exists. An Ubuntu package may already have installed a different Git binary, so a successful compilation does not by itself prove that your shell is running the newly built version.

Installing into /usr also means the files are managed outside the Ubuntu package database that supplied the distribution Git. Keep a note of the source version, configure command, and install date so that another administrator can identify which files came from the source build.

Verify the executable that Ubuntu is actually using

Run both checks after installation:

git --version
command -v git

git --version reports the version returned by the command, while command -v git prints the executable path selected by your shell. Read the path before investigating a version mismatch. If the reported version is still the Ubuntu package version, the shell is resolving a different Git installation than the one you just built; PATH order and the configured installation prefix determine which executable runs.

Open a new shell or refresh your shell’s command lookup if your environment has cached an earlier path. Then run the two checks again. Do not diagnose the build from the version number alone: confirm both the version and the resolved path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build Git with documentation included

Documentation is an explicit build choice rather than an automatic consequence of compiling Git. Install asciidoc, xmlto, docbook2x, and install-info before configuring or building the documentation targets. Then use:

make configure
./configure --prefix=/usr
make all doc info
sudo make install install-doc install-html install-info

The doc target generates the documentation content, info generates GNU info output, and the corresponding install targets copy those results into the configured prefix. If you only need Git’s executable, omit both the documentation packages and the doc, info, install-doc, install-html, and install-info targets.

When a documentation build fails

  • Confirm that all four documentation packages were installed, including install-info.
  • Run the documentation build from the same source directory that was configured.
  • Read the first missing-command or missing-file message; later errors can be consequences of that initial failure.
  • If documentation is not required, return to the binary-only sequence with make all and sudo make install.

Keep the upstream and Ubuntu source workflows separate

Compiling an upstream release tarball is not the same as rebuilding Ubuntu’s packaged Git. Ubuntu documents a separate workflow using git-ubuntu, pull-pkg, apt-get source, and dget. That process preserves Ubuntu’s packaging metadata and patches rather than installing the upstream project’s release directly.

Workflow Starting material Purpose
Upstream source build A tagged Git release tarball or upstream repository checkout Install an upstream Git version using the project’s configure and make sequence.
Ubuntu package-source rebuild Ubuntu source-package metadata and tools such as git-ubuntu, pull-pkg, apt-get source, or dget Rebuild or modify the version packaged for Ubuntu.

If you use apt-get source, matching deb-src entries must be enabled in your APT sources configuration. That requirement applies to Ubuntu source packages, not to the upstream tarball procedure in this guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot the common failure points

make configure cannot start

Make sure you are inside the extracted Git source directory and that the core dependency command completed successfully. A command run from the wrong directory will not find the project’s make targets.

./configure reports a missing library

Recheck the core development packages: libcurl4-gnutls-dev, libexpat1-dev, libz-dev, and libssl-dev. These are the documented Debian/Ubuntu development dependencies. After installing a missing package, rerun the configure step from the source tree.

The build succeeds but installation is denied

The compile commands can run as your regular account, but writing into /usr requires administrator privileges. Use sudo make install, or the full documentation install command when documentation was built.

The installed version appears unchanged

Run command -v git and inspect the path. A different executable earlier in PATH can mask the source-built binary. Compare that path with the /usr prefix selected during configuration before changing anything else.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Documentation targets fail while binaries build

The binary and documentation targets have different prerequisites. Install the four documentation packages, or intentionally perform a binary-only installation without the documentation targets.

Updating a source-built Git installation

When a newer upstream release is needed, obtain its tagged tarball, extract it into a new directory, and repeat the same dependency, configure, build, install, and verification sequence. Record the release version and the output of command -v git after each update.

Because the source installation is outside Ubuntu’s normal package ownership, do not assume that an apt-get upgrade will update it. Conversely, installing or upgrading Ubuntu’s package can leave multiple Git executables on the system. Always verify the selected path and version after changing either installation.

A concise command reference

Minimal binary build

sudo apt-get update
sudo apt-get install dh-autoreconf libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
cd git-<version>
make configure
./configure --prefix=/usr
make all
sudo make install
git --version
command -v git

Build with documentation

sudo apt-get update
sudo apt-get install dh-autoreconf libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
sudo apt-get install asciidoc xmlto docbook2x install-info
cd git-<version>
make configure
./configure --prefix=/usr
make all doc info
sudo make install install-doc install-html install-info
git --version
command -v git

This sequence gives you an upstream Git installation while making the two decisions that matter most explicit: whether documentation is needed and which executable your shell is using afterward.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.