iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
To compile upstream Git on Ubuntu, install the build dependencies, obtain a tagged Git release, run make configure, configure it with an installation prefix, compile it, and install the binaries. The documented sequence is:
sudo apt-get update
sudo apt-get install dh-autoreconf libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
cd git-2.56.0
make configure
./configure --prefix=/usr
make all
sudo make install
Add the documentation packages and the doc and info targets when you also want Git’s man pages, HTML documentation, and Info files. Building from source is useful when the upstream release is newer than Ubuntu’s package or you need a customized build; Ubuntu’s package manager remains the simpler default.
Free tools Windows power users keep installed
One-click scans. No signup required.
| # | Preview | Product | Price | |
|---|---|---|---|---|
| 1 |
|
Pro Git | Buy on Amazon | |
| 2 |
|
Pro Git (Expert's Voice in Software Development) | $37.07 | Buy on Amazon |
| 3 |
|
Professional Git | $24.79 | Buy on Amazon |
| 4 |
|
Pro Git 1st (first) edition Text Only | $83.26 | Buy on Amazon |
| 5 |
|
Git: Github Programming, In 8 Hours, For Beginners, Learn Coding Fast: Git Github Language, Crash... | $2.99 | Buy on Amazon |
When compiling Git from source makes sense
Ubuntu’s repository gives you a Git build integrated with the distribution’s package database, update process, filesystem conventions, and security maintenance. The Git project describes this package-manager route as the easiest way to install Git on Linux.
Source installation is worthwhile when you need a newer upstream release, a build option not enabled by Ubuntu, or a reproducible build process under your control. The Git project’s Linux installation page lists version 2.56.0 as the latest version at the time of writing. Ubuntu Noble’s package metadata lists Git source package version 1:2.43.0-1ubuntu7.3, so an Ubuntu installation can legitimately be behind upstream even when the operating system is fully updated.
#1 Best Overall
| Approach | Best for | Trade-off |
|---|---|---|
| Ubuntu package | Most users who want a supported, integrated installation | May lag behind the latest upstream release |
| Source tarball | Users who need a current upstream version or custom build | You must manage compilation, installation, and future updates |
| Ubuntu source-package workflow | Rebuilding or modifying Ubuntu’s packaged Git | Uses Ubuntu packaging tools and sources rather than a plain upstream build |
Choose one route deliberately. Compiling an upstream release tarball is not the same operation as rebuilding Ubuntu’s package.
Check what Ubuntu already has
Before changing anything, record the Git executable and version currently selected by your shell:
git --version
command -v git
git --version reports the running Git release. command -v git reports the executable path selected by your PATH. Save both outputs so you can tell whether a later installation changed the command your shell invokes.
If Git is not installed and you only need the distribution build, the short path is:
sudo apt-get update
sudo apt-get install git
Continue with a source build when the repository version or its build options do not meet your requirements.
Understand the installation paths
The canonical upstream example uses --prefix=/usr. That places the compiled files under the system’s normal /usr hierarchy and can put the source-built executable alongside or ahead of files managed by Ubuntu’s package.
Because both installations can provide a command named git, verify the resolved path after installation. A source build under /usr does not by itself guarantee that every shell, script, service, or user will run that copy; PATH order determines which executable is found first.
For an isolated installation, you can choose a different prefix when configuring, but the documented sequence in the Pro Git installation chapter uses /usr. If you choose another prefix, use its bin directory in your PATH and check the result with command -v git.
Rank #2
Install the build dependencies
Update APT’s package indexes first, then install the core dependencies documented for a Debian or Ubuntu build:
sudo apt-get update
sudo apt-get install dh-autoreconf libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
These packages provide the build machinery and development headers or libraries needed by Git’s configure and compilation steps. Install them before running make configure; otherwise configuration can stop with missing-tool or missing-header errors.
Packages needed for documentation
Git’s documentation targets require additional tools:
sudo apt-get install asciidoc xmlto docbook2x install-info
Do not install these packages merely to produce Git’s binaries. A binary-only build can omit the documentation targets and their extra dependencies.
| Build goal | Core packages | Additional packages | Make targets |
|---|---|---|---|
| Git binaries only | dh-autoreconf, libcurl4-gnutls-dev, libexpat1-dev, gettext, libz-dev, libssl-dev |
None from the documentation list | make all, then sudo make install |
| Binaries plus generated documentation | All core packages | asciidoc, xmlto, docbook2x, install-info |
make all doc info, then sudo make install install-doc install-html install-info |
Obtain an upstream Git release
Use a tagged release tarball from the Git project’s kernel.org location or its GitHub mirror. Download the release you intend to run, then extract it. The directory name normally identifies the release, such as git-2.56.0.
For a development checkout rather than a release archive, the Git project documents cloning its repository directly:
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →git clone https://git.kernel.org/pub/scm/git/git.git
A checkout from the repository can contain work newer than a numbered release and is therefore a different maintenance choice. A tagged release tarball is generally easier to identify and reproduce.
Enter the extracted source directory
Change into the directory created by extraction. For the 2.56.0 release, for example:
Rank #3
cd git-2.56.0
If you selected another tag, use that extracted directory name instead. Run the remaining commands from this top-level source directory, where Git’s build files and configure generation rules are present.
Build and install Git without documentation
This is the shortest source build when you need the Git executables and do not need generated man pages, HTML, or Info files.
- Generate the configure script. Run
make configurefrom the extracted source directory. - Set the installation prefix. Run
./configure --prefix=/usr. The prefix controls where the compiled files will be installed. - Compile Git. Run
make all. This builds the programs but does not install them into the system. - Install the result. Run
sudo make install. Administrative access is needed for a system-wide installation under/usr.
make configure
./configure --prefix=/usr
make all
sudo make install
Keep the source directory until you have verified the installation. It is useful for inspecting configuration output, repeating the build, or diagnosing a failed target.
Build Git with man pages, HTML, and Info files
Install the documentation dependencies before selecting documentation targets:
sudo apt-get install asciidoc xmlto docbook2x install-info
Then run the complete documented sequence:
make configure
./configure --prefix=/usr
make all doc info
sudo make install install-doc install-html install-info
What each documentation target does
docbuilds Git’s documentation output, including the man-page source and generated documentation where supported by the build.infobuilds GNU Info files.install-doc,install-html, andinstall-infocopy the corresponding generated files into the installation prefix.
If one of the documentation tools is missing, the documentation phase can fail even though the core source is otherwise ready to compile. Install the complete documentation package list and rerun the command from the source directory.
Verify which Git is running
After installation, check both the reported version and the executable path:
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →git --version
command -v git
For a source build based on the current Git project page, the expected release family is 2.56.0 only if you downloaded that exact tag. The version output must match the archive or checkout you selected; do not assume that installing from source automatically means the newest release.
Compare the path with the prefix you configured. With --prefix=/usr, the selected executable should resolve within the system’s normal /usr locations. If the shell still reports an older copy, inspect the path and your shell’s command lookup order before rebuilding.
When the version appears unchanged
- Run
command -v gitto identify the executable actually being used. - Check whether another directory earlier in
PATHcontains Git. - Open a new shell if your current shell has cached a command location, then repeat both checks.
- Confirm that the configured prefix is the one whose
bindirectory you are examining.
These checks distinguish a failed build from a successful installation that is being shadowed by another executable.
Use the correct workflow for Ubuntu’s packaged source
Ubuntu also documents a source-package workflow using tools such as git-ubuntu, pull-pkg, apt-get source, and dget. That workflow is for obtaining, modifying, or rebuilding Ubuntu’s packaged source and is separate from compiling an upstream release tarball.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchAPT source entries are required
When using apt-get source, matching deb-src entries must be enabled in the APT sources configuration. Without source repositories configured for the relevant Ubuntu release, APT cannot retrieve the package’s source records.
Choose this route when you need Ubuntu’s packaging patches, metadata, or integration. Choose the upstream tarball route when your goal is simply to compile a tagged Git release supplied by the Git project.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Common failures and precise fixes
make configure fails immediately
Install the core dependency list, return to the source directory, and rerun:
sudo apt-get update
sudo apt-get install dh-autoreconf libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
make configure
Run the command from the extracted Git top-level directory, not from its parent directory or a subdirectory.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errors./configure reports a missing library or header
Review the missing component named in the configure output and confirm that the corresponding development package from the core list is installed. On Ubuntu, runtime libraries and development packages are not interchangeable: compilation needs the development files.
Documentation generation fails
Install asciidoc, xmlto, docbook2x, and install-info, then rerun the documentation build:
Best Value
sudo apt-get install asciidoc xmlto docbook2x install-info
make all doc info
If you do not require documentation, omit doc and info and build only with make all.
Installation fails with a permission error
A system-wide prefix such as /usr requires administrative privileges during the install phase. Re-run only the install command with sudo; compilation itself should normally run as your regular user:
Recommended Free Tools
sudo make install
For a documentation build, use the corresponding privileged install targets:
sudo make install install-doc install-html install-info
The shell still runs Ubuntu’s older Git
Check command -v git and compare the result with the configured prefix. A different directory earlier in PATH can take precedence. Correct the path order for the account or environment that needs the source-built Git, then open a new shell and verify again.
You installed the wrong release
Read the version printed by git --version and compare it with the tag or archive directory you selected. Source installation does not infer your intended release; the downloaded source determines the result.
Updating a source-built Git
A source installation does not become current through Ubuntu’s normal package updates. To move to a newer upstream release, obtain the newer tagged source, extract it into a new directory, install the dependencies if necessary, repeat the configure and build sequence, and verify the new path and version.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Keep a record of the tag, configure options, and documentation choice used for each build. Reusing the same prefix makes path verification especially important when a distribution-managed Git remains installed.
Source build checklist
- Decide whether the upstream version or a custom build justifies leaving Ubuntu’s package-managed route.
- Record the current outputs of
git --versionandcommand -v git. - Install the six core build dependencies.
- Install the four documentation packages only when building documentation.
- Obtain and extract a tagged upstream release, or clone the documented Git repository for a development checkout.
- Run
make configureand./configure --prefix=/usr. - Use
make allfor binaries, ormake all doc infofor binaries plus documentation. - Install with the matching
sudo make installcommand. - Run
git --versionandcommand -v gitagain to verify the result and resolve any path mismatch.
Which method should you choose?
Use Ubuntu’s package when integration, routine security updates, and minimal administration matter most. Use an upstream source build when the distribution release is behind the Git version you need or when you require control over the build. Use Ubuntu’s source-package tools when you are specifically rebuilding Ubuntu’s packaged Git rather than installing an unmodified upstream release.
Quick Recap
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.

