How to Install the Latest Git on Linux

How to Install the Latest Git on Linux

After apt install git, git –version may report a release behind the version on Git’s source page. That version line gives me pause: the install command alone does not identify the release you get.

Set the Git release you want as the install target. Then choose the version source that can provide it.

Choose the Git version source that fits

Git’s upstream project publishes source releases, while Linux distributions publish their own package versions.

The Git source page lists 2.56.0, released on September 28, 2026. Launchpad lists 2.55.0 for Ubuntu 24.04 Noble in the Git-maintainers PPA.

Use your distribution package when its candidate is new enough, or build the source release when you need the version listed by Git.

I chose the source archive for Ubuntu Noble because its PPA candidate is 2.55.0 while the upstream page lists 2.56.0. A distribution package remains the package-manager route when its version meets the project requirement.

SourceWhat you getChoose it when
Distribution repositoryThe Git package selected from enabled repositoriesYou want distro-managed updates and its version meets your needs
Git-maintainers PPA on UbuntuA newer Ubuntu package, when the PPA candidate is available for your releaseYou accept a third-party package source and its candidate is recent enough
Git upstream source archiveThe release named on Git’s source pageYou need that upstream version and can build software from source

Check the PPA’s apt candidate against Git’s source page, because the package can trail the current upstream release.

What you need to build Git on Ubuntu

The source-build steps use Ubuntu and install Git under your home directory. You need sudo access for build tools and a network connection.

Git 2.56.0 also builds a Rust component. That component specifies Rust 1.63 or newer as its minimum.

Ubuntu 24.04’s package index lists Rust and Cargo 1.75.0, and this Ubuntu version command confirms which release you run.

  • Install compiler tools and the Git development libraries through apt.
  • Install Rust and Cargo if they are not already available.
  • Keep the same install prefix for both the build and install commands.
sudo apt update
sudo apt install build-essential curl libcurl4-openssl-dev libexpat1-dev gettext libssl-dev zlib1g-dev rustc cargo

These package names are for Ubuntu. On another distribution, install the matching compiler, Cargo, and development packages from that distribution’s documentation before building the Git archive.

Build the current upstream Git release on Ubuntu

When Ubuntu’s package sources do not carry the Git release you need, build the source archive in a user-local prefix.

1. Download the current source archive

Use the current stable version on the Git source page to form the matching kernel.org archive name.

curl -LO https://www.kernel.org/pub/software/scm/git/git-2.56.0.tar.xz

The curl download instructions explain the command options. The saved filename includes its release number.

2. Unpack and compile Git

Git’s source build uses Cargo for its Rust component. Cargo may download crate dependencies while make runs, so leave the network connection available through compilation.

tar -xf git-2.56.0.tar.xz
cd git-2.56.0
make prefix="$HOME/.local" all

Git compiles the install prefix into its helper paths, so changing it only during installation can leave those helpers elsewhere. I used the same user-local prefix for both make commands.

Files under .local are not managed by apt, so update that copy by building the newer upstream archive with the same prefix.

3. Install the compiled files

Install the files to the same prefix used by make. A user-local destination avoids replacing the Git package managed by apt.

make prefix="$HOME/.local" install

4. Put the new Git on PATH and check it

Add the user-local bin directory to the front of PATH in the current terminal, then ask Git for its version. This selects the source build instead of the distribution binary when both are installed.

export PATH="$HOME/.local/bin:$PATH"
git --version
Git 2.56.0 version output in the terminal
The upstream build reports git version 2.56.0.

I built Git from its upstream archive under a user-local prefix, so its version command returned 2.56.0.

Use your distribution package when its version is enough

Use a distribution package when its candidate matches your project requirements. Git’s Linux install page lists the package command for each supported distribution.

DistributionInstall commandVersion source
Debian or Ubuntusudo apt install gitEnabled apt repositories
Fedorasudo dnf install gitEnabled DNF repositories
Arch Linuxsudo pacman -S gitPacman repositories, see the Pacman package manager guide
openSUSEsudo zypper install gitEnabled Zypper repositories

Each command installs the version published in that distribution’s enabled repositories. Package versions can therefore differ across distributions.

Git’s Linux page points Ubuntu users to the Git-maintainers PPA for stable upstream packages. Review the support boundary before adding it, because Launchpad labels those packages unsupported third-party software.

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

The apt candidate comes from your enabled repositories. The git –version command identifies the active executable, and the installed-package listing helps you inspect the system package separately.

Set your Git commit identity

Git writes your configured name and email into new commits as author metadata. SSH keys or HTTPS credentials authenticate remote access.

Set a default identity for repositories on this account with global configuration. Replace the example values before you commit your own work.

git config --global user.name "Example User"
git config --global user.email "[email protected]"
git config --global --list
Global Git user name and email after configuration
The global settings provide a default name and email for new commits.

The screenshot shows example values that I set in an isolated home directory.

Git reads repository-local settings before the account-wide defaults, so one project can use a different name or email. The Pro Git first-time setup chapter explains that precedence.

Your commit email can be visible in published history. If you push to GitHub, its commit email settings explain how to use a no-reply address.

I keep SSH setup separate from Git installation because keys handle remote authentication, not the local Git version.

GitHub’s SSH key instructions cover adding a key.

Fix an old version or a failed build

An older version can come from the executable path or the package source. A source build fails when a required tool or header is missing, so match the message to the step that supplied Git.

If you need a newer version through apt, compare its candidate with the release on Git’s source page. A PPA can help when it publishes a suitable package for your Ubuntu release.

SymptomCheckNext action
Git reports an older release than expectedRun command -v git, then compare git –version with apt-cache policy gitMove the intended bin directory earlier in PATH, or select a newer package source
The apt candidate is older than the upstream versionRun apt-cache policy git after apt updateUse a supported PPA candidate if it meets your need, or build the current source archive
The build says cargo is missingRun rustc –version and cargo –versionInstall Rust and Cargo, then start make again
The compiler cannot find openssl/ssl.h or curl headersCheck the development-library packages, not only the runtime librariesInstall libssl-dev and libcurl4-openssl-dev before rebuilding
Git starts but cannot find its helper programsCompare the prefix passed to make all with the prefix passed to make installRebuild and install with the same prefix value

When removing an apt-managed copy before switching methods, follow the steps for removing packages with apt. Do not remove the system package just to make a user-local build take precedence.

Make sure your shell runs the Git you installed

PATH order decides which Git runs when you type the command. Check the resolved executable in the terminal you plan to use, then compare its version with the one you wanted.

command -v git
git --version

If the path points to the distribution copy, keep the user-local bin directory ahead of it in your shell’s startup file. That leaves both installs available while making the selected version explicit.

Frequently asked questions

The version selected by apt and the name stored in a Git commit come from different settings.

How do I install the latest version of Git with apt?

apt installs the candidate available from your enabled repositories. Compare that candidate with Git’s upstream source page when you need the current upstream release.

How do I check which Git version Linux runs?

Run git –version to see the executable found on PATH. Run command -v git to identify its path, and apt-cache policy git to see the package candidate.

Should I configure Git name and email globally?

Use global settings when the same identity should apply to all repositories for your account. Set repository-local values when one project needs a different commit identity.