When you’re working in a DevOps team, one of the first things you’ll often be asked to do is set up a Git repository for developers to collaborate on code. In this short guide, we’ll walk through how to do exactly that—install Git and create a bare Git repository on a Linux-based Storage Server.
Why a Bare Repository?
A bare repository is a Git repository that doesn’t have a working directory. That means you can’t directly edit or work with files there. It’s mainly used as a centralized remote repository that teams push to and pull from. Perfect for collaboration and production environments.
Step 1: Install Git on the Storage Server
Most Linux servers, especially RHEL or CentOS-based ones, don’t have Git pre-installed. To install Git using yum, simply run:
sudo yum install git -y
This will install Git and its dependencies silently without prompting for confirmation thanks to the -y
flag.
Step 2: Create the Bare Repository
Once Git is installed, it’s time to create the actual repository. The requirement is to create a bare repository named /opt/official.git.
Here’s how to do that:
sudo git init --bare /opt/official.git
The --bare
flag tells Git to create a repository meant solely for sharing—not for editing files directly. The path /opt/official.git
is exactly what the team requested, so make sure it matches.
✅ Installed Git with yum
✅ Created a centralized bare repo at /opt/official.git
You’ve now set up a clean, professional remote Git repository that your dev team can start using for collaboration right away.
Happy DevOps’ing!