How To Install Git on CentOS 9 Stream
If you’re a developer or just someone who likes to keep a copy of your scripts, you’ll want Git on your CentOS 9 Stream box. This guide shows how to get the latest stable release without wrestling with EPEL or compiling from source.
1. Why the default repos don’t cut it
CentOS 9 Stream ships with an older git (2.34‑3.el9) that misses a few features and security fixes. Installing from the AppStream repo is quick, but if you need version 2.38 or newer, you’ll have to add the stream‑extras module.
2. Enable the “stream‑extras” module
sudo dnf module list git
You’ll probably see a git:2.34 stream already enabled. Switch it:
sudo dnf module disable git:2.34 -y sudo dnf module enable git:2.38 -y
The module system in CentOS lets you choose which version of a software stack you want, so enabling the newer stream pulls the fresh binaries and libraries.
3. Install Git
sudo dnf install git -y
After it finishes, confirm:
git --version
You should see something like git version 2.38.1. If you get a lower number, double‑check the module status.
4. Verify the SSH key setup
A lot of people run into “Permission denied (publickey)” when cloning over SSH after a fresh install. The fix is simple: add your public key to GitHub or Bitbucket, then test:
ssh -T git@github.com
If you get Hi username! You've successfully authenticated, you’re good.
5. Optional: Install the “git‑extra” package
Some folks find git-lfs and other helpers useful. If you need large file support, install it next:
sudo dnf install git-lfs -y git lfs install
No point installing a bloated GUI client just to stage files; stick with the CLI for speed.
I’ve seen this exact workflow fail when folks forget to disable the old module first—Git pulls the 2.34 binary and you’re stuck with the same bugs you had before. Once you enable the newer stream, all the pain disappears.
That’s it. Git is now ready to go on your CentOS 9 Stream machine.