VMHeaven

Troubleshooting

git: command not found — install Git on any Linux

Git is not part of a base server or container image. One package installs it on Debian, Ubuntu, Alpine, Rocky, Alma and Arch — plus the config to set first.

Updated 08 Aug 2026~4 min read

git: command not found means Git is not installed — it is not part of a base server or container image. One package fixes it on every distribution; the only nuance is picking the right package manager.

Install Git

Debian · Ubuntu
sudo apt update
sudo apt install -y git
Rocky · Alma · RHEL · Fedora
sudo dnf install -y git
Alpine
apk add --no-cache git
Arch · openSUSE
sudo pacman -S --noconfirm git      # Arch
sudo zypper install -y git           # openSUSE

Verify and set your identity

Confirm the install, then set the name and email every commit is stamped with — skip this and your first git commit will complain:

check + configure
git --version
git config --global user.name "Your Name"
git config --global user.email "[email protected]"

In a Dockerfile

Installing Git into an image is the same idea, with the cache cleaned in the same layer to keep the image small:

Dockerfile
RUN apt-get update && apt-get install -y git \
 && rm -rf /var/lib/apt/lists/*

Installed but still not found

If the package is present but the shell disagrees, it cached an old lookup or PATH is stripped:

reset lookup
hash -r
command -v git || ls -l /usr/bin/git
echo $PATH

Cloning a large repository is I/O-bound, so it benefits from fast storage. Every VMHeaven KVM plan runs on NVMe-backed enterprise storage, which keeps clones and builds quick.

Frequently asked

Do I need anything besides the git package?

Just set your identity: git config --global user.name and user.email. Without them your first commit will refuse to run.

Should Git be installed on a production server?

Not necessarily. Building in CI and copying the artefact over is cleaner than cloning a repository onto the live host.

Git is installed but still not found — why?

The shell cached an old lookup or PATH is stripped. Run 'hash -r' and check 'command -v git' and $PATH.

More in Troubleshooting

See all