Install Git on Fedora Linux – A Quick, No‑Nonsense Guide
Want to get version control up and running on Fedora? This post walks you through installing Git the easy way, plus a couple of backup tricks if the default repo throws a curveball.
Install Git on Fedora Linux Using DNF
1. Open a terminal – You’ll be typing commands, so make sure you’re in your home directory or wherever you normally work.
2. sudo dnf install git
Why this matters: DNF pulls the latest stable package from Fedora’s official repos and handles all dependencies automatically.
3. When prompted, type your password and hit Enter.
4. Confirm with y when asked to proceed.
5. Once the installation finishes, verify it:
git --version
You should see something like “git version 2.39.x”. If not, you probably missed a step.
Quick note: After Fedora 39 landed, I ran into folks who upgraded and suddenly had no git at all because the default repo was trimmed. Enabling the PowerTools (now called crb) module fixes that:
> sudo dnf install @development-tools. Then you can retry the DNF command.
Alternative: Compile from Source
If you need a newer Git than what Fedora ships, or want to tweak build options:
1. Install prerequisites:
sudo dnf groupinstall "Development Tools"
sudo dnf install openssl-devel curl-devel expat-devel gettext-devel zlib-devel
Why this matters: These libraries let Git talk to HTTPS, compress data, and handle international text properly.
2. Download the latest tarball from the official site:
wget https://github.com/git/git/archive/refs/tags/v2.40.0.tar.gz
3. Extract it: tar -xzf v2.40.0.tar.gz && cd git-2.40.0
4. Compile and install:
make configure ./configure --prefix=/usr/local make all sudo make install
Why this matters: Building from source ensures you get the exact features and bug fixes you want, rather than waiting for Fedora maintainers to package them.
5. Verify again with git --version.
Setting Up Your First Repo
1. Create a new project folder or navigate to an existing one:
mkdir myproject && cd myproject
2. Initialize Git: git init – This creates a hidden .git directory that stores all history.
3. Add a file, commit, and push to a remote if you have one:
echo "# My Project" > README.md git add README.md git commit -m "Initial commit"
4. If you’re using GitHub or another host, link it: git remote add origin <url> and git push -u origin master.
That’s all there is to it. Pick the method that fits your workflow; DNF for speed, source for control. Now go write some code and version‑control like a pro.