Get Started with Gitolite: Open Source Git Hosting on Your Own Server (Using Podman)

Install Gitolite with Podman
Install Gitolite with Podman

Live stream set for 2025-10-11 at 14:00:00 Eastern

Ask questions in the live chat about any programming or lifestyle topic.

This livestream will be on YouTube or you can watch below.

Host Your Own Git Server with Gitolite and Podman

Want to run your own Git server without relying on GitHub, GitLab, or Bitbucket? Gitolite is a powerful, open-source tool that lets you manage Git repositories on your own terms – with SSH-based access control, fine-grained permissions, and no need for a web interface.

In this post, I will show you how to install Gitolite inside a Podman container, taking full advantage of official repositories.

Why Gitolite?

  • Self-hosted Git server
  • Fine-grained access control using SSH keys
  • Lightweight and scriptable
  • 100% open source

Step 1: Prepare Your Admin SSH Key

You’ll need your SSH public key for administration. Save it as admin.pub in the same folder where you create the container files.

Step 2: Create the Containerfile

Create a file named Containerfile (or Dockerfile) with the following content:

FROM alpine:latest

# Install required packages
RUN apk add --no-cache git gitolite openssh

# Prepare SSH and home directory
RUN mkdir -p /var/run/sshd /home/git/.ssh && \
    chown -R git:git /home/git

# Generate SSH host keys
RUN ssh-keygen -A

# Copy your public key into the image
COPY admin_key.pub /tmp/admin_key.pub
RUN chown git:git /tmp/admin_key.pub

# Run gitolite setup as git user
RUN su git -c "gitolite setup -pk /tmp/admin_key.pub"

# Copy SSHD config (rootless-safe)
COPY sshd_config /etc/ssh/sshd_config

# Expose high port for rootless podman
EXPOSE 2222

CMD ["/usr/sbin/sshd", "-D", "-e"]

Step 3: Create the podman-compose.yml File

Create a podman-compose.yml file alongside the Containerfile:

version: "3.9"

services:
  gitolite:
    build: .
    container_name: gitolite
    ports:
      - "2222:2222"
    volumes:
      - gitolite_data:/home/git
    restart: unless-stopped

volumes:
  gitolite_data:

Step 4: Build and Run Your Gitolite Container

  1. Build the container image:
    podman-compose build
  2. Start the container:
    podman-compose up -d
  3. Your Gitolite server will be running and accessible on port 2222.

Step 5: Connect to Your Gitolite Server

From your host machine, clone the Gitolite admin repository using:

git clone ssh://git@localhost:2222/gitolite-admin

Now you can manage your repositories, users, and permissions by editing the Gitolite config and pushing changes.

Screenshots and Screencast Tutorial

SSH Key
Command Line Podman Generating SSH Key pair

Containerfile
Gnome Text Editor Displaying Podman Containerfile

SSH Config
Gnome Text Editor Displaying Podman SSH Configuration File

Compose YAML
Gnome Text Editor Displaying Podman Compose YAML File

Gitolite Container
Command Line Podman Compose Building Gitolite Container

Gitolite Clone Repo
Command Line Cloning Gitolite Admin Repository

Gitolite Create Repo
Command Line Pushing To Create New Gitolite Repository

Screencast Of Gitea Setup

Learn More with My Books and Courses

Need Help?

Conclusion

With Podman, setting up Gitolite is fast, clean, and secure. Whether you are managing your own projects or hosting for a team, this setup gives you total control over your source code and workflows.

Looking for more tutorials like this? Subscribe to my updates and follow along with future guides.

Recommended Resources:

Disclosure: Some of the links above are referral (affiliate) links. I may earn a commission if you purchase through them - at no extra cost to you.

About Edward

Edward is a software engineer, web developer, and author dedicated to helping people achieve their personal and professional goals through actionable advice and real-world tools.

As the author of impactful books including Learning JavaScript, Learning Python, Learning PHP, Mastering Blender Python API, and fiction The Algorithmic Serpent, Edward writes with a focus on personal growth, entrepreneurship, and practical success strategies. His work is designed to guide, motivate, and empower.

In addition to writing, Edward offers professional "full-stack development," "database design," "1-on-1 tutoring," "consulting sessions,", tailored to help you take the next step. Whether you are launching a business, developing a brand, or leveling up your mindset, Edward will be there to support you.

Edward also offers online courses designed to deepen your learning and accelerate your progress. Explore the programming on languages like JavaScript, Python and PHP to find the perfect fit for your journey.

📚 Explore His Books – Visit the Book Shop to grab your copies today.
💼 Need Support? – Learn more about Services and the ways to benefit from his expertise.
🎓 Ready to Learn? – Check out his Online Courses to turn your ideas into results.

Leave a Reply

Your email address will not be published. Required fields are marked *