How to Install Git on Linux Mint 22 and 21

Install Git on Linux Mint 22 and 21 with APT, the Git Maintainers PPA, or a checksum-checked source build. Covers setup, updates, removal, and fixes.

Last updatedAuthorJoshua JamesRead time7 minGuide typeLinux Mint

Linux Mint’s default Git package is fine for everyday commits, pulls, and branches, while the Git Maintainers PPA gives readers a current APT-managed build when the stock package is too old. You can install Git on Linux Mint with the default package, the PPA, or a managed source build, then set your commit identity and test a first repository before pushing code upstream.

Linux Mint 22.x and 21.x use the same install flow across Cinnamon, Xfce, and MATE. LMDE follows Debian packages instead, so the commands here stay focused on the Ubuntu-based Mint editions. If you choose the source build, the workflow keeps it inside a managed /usr/local/git-source tree with a reusable updater instead of a loose one-off compile.

Install Git on Linux Mint

The stock Mint package is the right starting point for most readers because it stays tied to the normal system update flow. The PPA is the better fit when you want the current stable Git branch through APT, while the managed source build is mainly for readers who want to inspect, compile, or update from upstream source when the packaged branches lag.

MethodChannelTypical versionUpdatesBest for
Linux Mint repositoriesUbuntu-based Mint packagesMint 22.x: Git 2.43.x
Mint 21.x: Git 2.34.x
apt upgradeMost users who want the simplest maintenance path
Git Maintainers PPAppa:git-core/ppaMint 22.x and 21.x: Git 2.54.xapt upgradeReaders who want a newer stable Git release through APT
Managed source buildUpstream stable tarball from kernel.orgMint 22.x and 21.x: Git 2.54.xupdate-git-sourceReaders who want a manually built upstream Git tree

If you mix package and source methods, the source-built git in /usr/local/bin takes precedence over the Mint package in /usr/bin. Pick the method you want active and confirm it with command -v git.

Refresh package metadata before you install Git on Linux Mint

Refresh APT first so the package versions and repository metadata match what your Mint system can actually install.

sudo apt update

These commands use sudo for tasks that need administrator privileges. If your account does not have sudo access yet, follow the guide to create and add users to sudoers on Linux Mint first.

Check whether Git is already installed on Linux Mint

Check Git first. If it is already present, you can skip the default install and decide only whether you want to stay on the stock package, move to the newer PPA build, or switch to the source build.

git --version

On Mint 22.x, relevant output includes:

git version 2.43.0

On Mint 21.x, relevant output includes:

git version 2.34.1

If Git is missing, the shell returns a command-not-found error and you can continue with one of these install methods.

Install Git from Linux Mint repositories

Install Git on Linux Mint with sudo apt install -y git when the stock package is current enough for your workflow. The -y flag accepts the package prompt so the install can finish in one pass.

sudo apt install -y git

On a system that has not installed Git yet, relevant output includes:

The following NEW packages will be installed:
  git git-man liberror-perl
0 to upgrade, 3 to newly install, 0 to remove and 0 not to upgrade.
Need to get 4,806 kB of archives.
After this operation, 24.5 MB of additional disk space will be used.
Preparing to unpack .../git_1%3a2.43.0-1ubuntu7.3_amd64.deb ...
Unpacking git (1:2.43.0-1ubuntu7.3) ...
Setting up git (1:2.43.0-1ubuntu7.3) ...

Verify the installed package state after APT finishes:

apt-cache policy git

Relevant output includes:

git:
  Installed: 1:2.43.0-1ubuntu7.3
  Candidate: 1:2.43.0-1ubuntu7.3
  Version table:
 *** 1:2.43.0-1ubuntu7.3 500
        500 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages
        100 /var/lib/dpkg/status

On Mint 21.x, the same check shows 1:2.34.1-1ubuntu1.17 from the jammy-updates and jammy-security pockets. A quick git --version check then prints git version 2.43.0 on Mint 22.x or git version 2.34.1 on Mint 21.x.

Install Git from the Git Maintainers PPA on Linux Mint

The Git Maintainers PPA is the clean way to move past Mint’s stock Git package while keeping updates inside APT. It currently raises the candidate to Git 2.54.0 on both Mint 22.x and 21.x.

Standard Mint desktops usually already include add-apt-repository through mintsources. If your system returns a command-not-found error for that helper, install it first:

sudo apt install -y mintsources

Add the PPA:

sudo add-apt-repository -y ppa:git-core/ppa

Refresh APT so Mint can see the new Git packages:

sudo apt update

Linux Mint maps the PPA to the Ubuntu base behind your Mint release: Mint 22.x uses noble, while Mint 21.x uses jammy. Confirm the candidate changed before you install it:

apt-cache policy git

On a system that has not installed Git yet, relevant output includes:

git:
  Installed: (none)
  Candidate: 1:2.54.0-0ppa1~ubuntu24.04.1
  Version table:
     1:2.54.0-0ppa1~ubuntu24.04.1 500
        500 https://ppa.launchpadcontent.net/git-core/ppa/ubuntu noble/main amd64 Packages
     1:2.43.0-1ubuntu7.3 500
        500 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages

On Mint 21.x, the candidate becomes 1:2.54.0-0ppa1~ubuntu22.04.1 from the jammy suite. Install or upgrade Git once the candidate looks right:

sudo apt install -y git

If Git is already installed from the default repositories, this upgrades the same package to the PPA build. Confirm the CLI version afterward:

git --version
git version 2.54.0

Install Git from source on Linux Mint

The source-build path is useful when you want to compile the current upstream Git release from the kernel.org Git source directory instead of waiting for a package source. This version uses a managed /usr/local/git-source tree and a reusable update-git-source command so updates and removal stay predictable.

Install the compiler toolchain, download helpers, and libraries Git needs for HTTPS, compression, and the expat parser:

sudo apt install -y build-essential curl ca-certificates xz-utils libssl-dev libcurl4-openssl-dev libexpat1-dev gettext zlib1g-dev

This updater builds the main Git CLI, verifies the downloaded tarball against kernel.org’s checksum list, and skips the optional gitk and git-gui Tcl/Tk tools to keep the dependency list smaller. The setup refuses unrelated existing files in /usr/local/bin before writing the helper or launcher.

if [ -e /usr/local/bin/update-git-source ] || [ -L /usr/local/bin/update-git-source ]; then
   if ! grep -q 'linuxcapable-managed-git-source-helper' /usr/local/bin/update-git-source 2>/dev/null; then
      echo "Refusing to replace existing /usr/local/bin/update-git-source because it is not managed by this workflow."
      exit 1
   fi
fi

if [ -e /usr/local/bin/git ] || [ -L /usr/local/bin/git ]; then
   if [ ! -L /usr/local/bin/git ] || [ "$(readlink /usr/local/bin/git)" != "/usr/local/git-source/current/bin/git" ]; then
      echo "Refusing to replace existing /usr/local/bin/git because it is not managed by this workflow."
      exit 1
   fi
fi

sudo tee /usr/local/bin/update-git-source > /dev/null <<'EOF'
#!/bin/bash
# linuxcapable-managed-git-source-helper
set -euo pipefail

if [[ "$(id -u)" -eq 0 ]]; then
   echo "Run this script as a regular user so build files stay in your home directory."
   exit 1
fi

for cmd in awk curl grep make mktemp nproc readlink sha256sum sort tar; do
   if ! command -v "$cmd" >/dev/null 2>&1; then
      echo "Error: $cmd is required but not installed."
      exit 1
   fi
done

BASE_URL="https://mirrors.edge.kernel.org/pub/software/scm/git"
BASE_DIR="/usr/local/git-source"
RELEASES_DIR="$BASE_DIR/releases"
CURRENT_LINK="$BASE_DIR/current"
BUILD_ROOT="${XDG_CACHE_HOME:-$HOME/.cache}/git-source-build"
mkdir -p "$BUILD_ROOT"

LATEST_TARBALL=$(curl -fsSL "$BASE_URL/" | grep -Eo 'git-[0-9]+\.[0-9]+\.[0-9]+\.tar\.xz' | sort -Vu | tail -n1)

if [[ -z "$LATEST_TARBALL" ]]; then
   echo "Could not resolve the latest Git source tarball."
   exit 1
fi

VERSION="${LATEST_TARBALL#git-}"
VERSION="${VERSION%.tar.xz}"
INSTALL_PREFIX="$RELEASES_DIR/git-$VERSION"
CURRENT_VERSION=""

if [[ -x "$CURRENT_LINK/bin/git" ]]; then
   CURRENT_VERSION=$("$CURRENT_LINK/bin/git" --version | awk '{print $3}')
fi

if [[ -e /usr/local/bin/git || -L /usr/local/bin/git ]]; then
   if [[ ! -L /usr/local/bin/git ]] || [[ "$(readlink /usr/local/bin/git)" != "$CURRENT_LINK/bin/git" ]]; then
      echo "Refusing to replace existing /usr/local/bin/git because it is not managed by this source build."
      exit 1
   fi
fi

if [[ "$CURRENT_VERSION" == "$VERSION" ]]; then
   if [[ ! -e /usr/local/bin/git && ! -L /usr/local/bin/git ]]; then
      sudo ln -sfn "$CURRENT_LINK/bin/git" /usr/local/bin/git
   fi
   printf 'Git is already up to date: %s\n' "$CURRENT_VERSION"
   exit 0
fi

WORKDIR=$(mktemp -d "$BUILD_ROOT/git-$VERSION-XXXXXX")
cleanup() {
   rm -rf "$WORKDIR"
}
trap cleanup EXIT

cd "$WORKDIR"
printf 'Downloading %s...\n' "$LATEST_TARBALL"
curl -fsSLO "$BASE_URL/$LATEST_TARBALL"
curl -fsSLO "$BASE_URL/sha256sums.asc"
if ! grep -F "  $LATEST_TARBALL" sha256sums.asc > "$LATEST_TARBALL.sha256"; then
   echo "Could not find a checksum entry for $LATEST_TARBALL."
   exit 1
fi
sha256sum -c "$LATEST_TARBALL.sha256"
tar -xf "$LATEST_TARBALL"
cd "git-$VERSION"

printf 'Building Git %s...\n' "$VERSION"
make prefix="$INSTALL_PREFIX" NO_TCLTK=YesPlease -j"$(nproc)" all >/dev/null

printf 'Installing Git %s...\n' "$VERSION"
sudo mkdir -p "$RELEASES_DIR"
sudo make prefix="$INSTALL_PREFIX" NO_TCLTK=YesPlease install >/dev/null
if [[ -e /usr/local/bin/git || -L /usr/local/bin/git ]]; then
   if [[ ! -L /usr/local/bin/git ]] || [[ "$(readlink /usr/local/bin/git)" != "$CURRENT_LINK/bin/git" ]]; then
      echo "Refusing to replace existing /usr/local/bin/git because it is not managed by this source build."
      exit 1
   fi
fi
sudo ln -sfn "$INSTALL_PREFIX" "$CURRENT_LINK"
sudo ln -sfn "$CURRENT_LINK/bin/git" /usr/local/bin/git

if [[ -n "$CURRENT_VERSION" && -d "$RELEASES_DIR/git-$CURRENT_VERSION" ]]; then
   sudo rm -rf "$RELEASES_DIR/git-$CURRENT_VERSION"
fi

printf 'Git is now active: %s\n' "$(/usr/local/bin/git --version)"
EOF
sudo chmod +x /usr/local/bin/update-git-source

Since the script is installed to /usr/local/bin, you can run it from any directory in your terminal. Run it once to perform the first source install:

update-git-source

Relevant output includes:

Downloading git-2.54.0.tar.xz...
git-2.54.0.tar.xz: OK
Building Git 2.54.0...
Installing Git 2.54.0...
Git is now active: git version 2.54.0

Clear the current shell’s command cache, then confirm that the source build is now the active Git binary:

hash -r
command -v git
git --version

Relevant output includes:

/usr/local/bin/git
git version 2.54.0

Configure Git on Linux Mint

Git works immediately after installation, but it is easier to use once your author identity is in place. These global settings live in ~/.gitconfig and apply to every repository you create or clone on this Mint account.

Set your Git username and email on Linux Mint

Set the identity Git writes into each commit:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Verify that Git saved both values. The grep filter trims the full config list to the two identity lines, and the grep command in Linux with examples reference is useful when you want to filter longer terminal output the same way.

git config --list --show-origin | grep -E 'user.name|user.email'
file:/home/your-user/.gitconfig	user.name=Your Name
file:/home/your-user/.gitconfig	user.email=you@example.com

If you want a deeper breakdown of local versus global settings, follow the guide to configure Git username and email.

Initialize a quick Git test repository on Linux Mint

A small test directory confirms that Git can create repository metadata and start tracking files correctly.

mkdir -p ~/git-test
cd ~/git-test
git init
git rev-parse --is-inside-work-tree

Relevant output includes:

Initialized empty Git repository in /home/your-user/git-test/.git/
true

If you would rather start from an existing project, replace git init with git clone https://example.com/project.git in a directory where you want the repository copied.

Fix Common Git Problems on Linux Mint

Most Git problems on Linux Mint come down to missing commit identity, SSH authentication, or running Git commands outside a repository. These are the quickest fixes to keep nearby.

Fix Git author identity unknown on Linux Mint

If a commit stops with Author identity unknown, Git does not have a username and email address to write into the commit metadata. Set a global identity for your Mint account, or replace --global with --local inside a repository when only that project should use the values.

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Check the saved values before retrying the commit:

git config --global --get user.name
git config --global --get user.email

Fix Git SSH authentication problems on Linux Mint

When GitHub or GitLab rejects an SSH push with a public-key error, the usual cause is a missing key pair or a public key that was never added to the account.

ssh-keygen -t ed25519 -C "you@example.com"

Display the public key you need to paste into GitHub or GitLab:

cat ~/.ssh/id_ed25519.pub

Test the connection after you add that key to the account:

ssh -T git@github.com
Hi username! You've successfully authenticated, but GitHub does not provide shell access.

If the ssh command itself is missing on a stripped-down system, install OpenSSH first with the guide to install OpenSSH on Linux Mint. For other client flags beyond this Git test, see the SSH command in Linux reference.

Fix the not-a-repository error in Git on Linux Mint

Git prints fatal: not a git repository when you run repository commands outside a directory that already has a .git folder.

git init
git rev-parse --is-inside-work-tree

Relevant output includes:

Initialized empty Git repository in /home/your-user/project/.git/
true

If the directory is already a repository, move back to its root before you run commit, branch, or push commands.

Update or Remove Git on Linux Mint

APT-managed Git stays inside the normal package workflow, while the source-build method uses its own updater and managed install tree. Keep using the maintenance path that matches the method you installed.

Update Git from the Linux Mint repositories or the PPA

Use APT to refresh package metadata and upgrade Git in one pass. The --only-upgrade flag updates Git without turning a machine that does not have Git yet into a new install.

sudo apt update && sudo apt install --only-upgrade -y git

Follow that with git --version whenever you want a quick CLI check on the currently active version.

Update source-built Git on Linux Mint

If you used the source-build method, rerun the same updater command from any terminal directory. It checks the current release first and only downloads a new tarball when upstream publishes a newer stable Git version.

update-git-source

Relevant output includes:

Git is already up to date: 2.54.0

When a new Git release is available, the script downloads the new tarball, compiles it in ~/.cache/git-source-build, installs it into the managed tree, and updates the /usr/local/bin/git launcher automatically.

Avoid automating this with cron. Compilation can fail because of dependency changes, failed builds, or network problems, so it is better to run the updater manually and watch the output.

Remove APT-managed Git from Linux Mint

Use purge for the package removal so APT clears package-managed configuration remnants along with the binary.

sudo apt purge -y git

Then review the cleanup list before you remove dependencies that only Git needed. On a typical Git-only install, this list usually includes git-man and liberror-perl.

sudo apt autoremove

If you used the Git Maintainers PPA, remove that repository and refresh APT:

sudo add-apt-repository --remove -y ppa:git-core/ppa
sudo apt update

Verify the package is gone. On Mint 22.x with the stock repositories still enabled, relevant output includes:

apt-cache policy git
git:
  Installed: (none)
  Candidate: 1:2.43.0-1ubuntu7.3
  Version table:
     1:2.43.0-1ubuntu7.3 500
        500 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages

On Mint 21.x, the same check falls back to 1:2.34.1-1ubuntu1.17 from the jammy pockets after the PPA is gone.

Remove source-built Git from Linux Mint

If you used the source-build method, remove the launcher command, the managed install tree, and the cached build files:

This cleanup permanently deletes every Git release installed by the source-build method and the build cache under your account. Back up anything custom you placed under /usr/local/git-source before removing the tree.

if [ -f /usr/local/bin/update-git-source ] && grep -q 'linuxcapable-managed-git-source-helper' /usr/local/bin/update-git-source 2>/dev/null; then
   sudo rm -f /usr/local/bin/update-git-source
else
   echo "Skipped /usr/local/bin/update-git-source because it is missing or not managed by this workflow."
fi

if [ -L /usr/local/bin/git ] && [ "$(readlink /usr/local/bin/git)" = "/usr/local/git-source/current/bin/git" ]; then
   sudo rm -f /usr/local/bin/git
else
   echo "Skipped /usr/local/bin/git because it is missing or not managed by this workflow."
fi

sudo rm -rf /usr/local/git-source
rm -rf ~/.cache/git-source-build

Verify that the source-build artifacts are gone:

hash -r
test -e /usr/local/bin/update-git-source || echo "update-git-source removed"
test -e /usr/local/git-source || echo "/usr/local/git-source removed"
update-git-source removed
/usr/local/git-source removed

If you also kept a packaged Git install, run hash -r before checking the command path. After the source-build launcher is gone, command -v git falls back to /usr/bin/git.

Conclusion

Git is ready on Linux Mint whether you stayed with Mint packages, moved to the PPA, or kept a managed source build. If you prefer a graphical client, install GitHub Desktop on Linux Mint. For common terminal follow-up tasks, keep the guides to switch Git branches and undo the last Git commit nearby.

Share this guide

Help another Linux user troubleshoot faster

Share this guide with someone troubleshooting Linux systems or saving it for later.

Follow LinuxCapable

Want more LinuxCapable guides in Google?

Add LinuxCapable as a preferred source so Google can show more of our fresh Linux tutorials in Top Stories and From your sources when relevant.

Add LinuxCapable as a preferred source on Google
Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffeeBuy me a coffee
Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed in published comments:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Got a Question or Feedback?

We read and reply to every comment - let us know how we can help or improve this guide.

Verify before posting: