Getting Started with Gogs Locally Using Git and Podman

GOGS: The GitHub Alternative
GOGS: The GitHub Alternative

Live stream set for 2025-11-02 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.

Introduction to Gogs: Your Lightweight, Personal Git Service

Are you looking for a simple, fast, and easy way to host your own Git repositories? Meet Gogs, the open source “Go Git Service.” Think of it as your own personal, lightweight alternative to platforms like GitHub or GitLab, designed to be set up with minimal fuss on your own server.

Gogs is written in the Go language and is designed for simplicity and low resource consumption, making it perfect for smaller teams, personal projects, or even running on low-powered devices like a Raspberry Pi. Best of all, because it’s open source, you get full transparency and control over your code hosting environment.

Setting Up Gogs with Podman-Compose

Using containers is the easiest and most recommended way to install Gogs. We’ll use Podman-a daemonless container engine-and Podman-Compose-a tool for defining and running multi-container applications-to get Gogs and its database running quickly and securely.

Prerequisites

  • Podman installed on your server/local machine.
  • Podman-Compose (often installed via pip).
  • A directory for your configuration files.

Step 1: Create a compose.yaml File

Create a file named compose.yaml (or docker-compose.yaml as Podman-Compose often supports Docker Compose files) to define your Gogs service and its required SQLite database volume. We’ll use the official Gogs image.

version: "3"

services:
  gogs:
    image: gogs/gogs
    container_name: gogs
    restart: always
    ports:
      - "3000:3000" # Web UI
      - "2222:22"   # SSH Access (Change Host Port if needed)
    volumes:
      # This volume stores all your repositories, configurations, and data.
      - gogs_data:/data 
    environment:
      # Optional: You can set the user Gogs runs as for rootless Podman
      - USER_UID=1000
      - USER_GID=1000

volumes:
  gogs_data:

Step 2: Start Gogs

Navigate to the directory containing your compose.yaml file and execute the following command:

podman-compose up -d

This command pulls the Gogs image (if not already local), creates the volume, and starts the container in the background (-d).

Step 3: Initial Setup

Open your web browser and navigate to the Gogs web interface. If you are running it on your local machine, this will typically be http://localhost:3000.

  • Fill out the initial configuration form.
  • For a simple setup, choose SQLite3 as the Database Type.
  • Set the Run User to git (the default user inside the container).
  • Set the Application URL to the external URL your users will use (e.g., http://your-server-ip:3000/).
  • Crucially: Scroll down to create your first Admin Account.

Once configured, click Install Gogs.

Cloning and Pushing Your Code

After installation, create a new repository in your Gogs web interface (e.g., named my-first-repo). Gogs will provide you with the commands needed to clone and push your code.

Assuming your repository is called my-first-repo and your username is myuser, here are the standard Git commands you’ll use from your local development machine:

Cloning the Repository

To get a local copy of your new, empty repository (using HTTPS in this example):

# Replace 'your-server-ip:3000' and 'myuser/my-first-repo' with your details
git clone http://your-server-ip:3000/myuser/my-first-repo.git

Pushing Code to Gogs

  1. Navigate into your new local repository directory:
    cd my-first-repo
    
  2. Create an initial file and commit it:
    echo "# My First Gogs Project" >> README.md
    git add .
    git commit -m "Initial commit of README"
    
  3. Push your local changes to your Gogs server:
    # 'origin' is the default name for the remote repository you cloned from
    git push origin master
    

You will be prompted for your Gogs username and password. After a successful push, refresh the repository page in Gogs to see your new file!

Screenshots and Screencast Tutorial

SSH Key
Command Line Podman Generating SSH Key pair

Compose YAML
Gnome Text Editor Displaying Podman Compose YAML File

Gogs Container
Command Line Podman Compose Building Gogs Container

Gogs Setup
Web Browser Displaying Gogs Installation Setup Screen

Gogs Dashboard
Web Browser Displaying Gogs Dashboard

Gogs Admin
Web Browser Displaying Gogs Admin Panel

Gogs SSH Keys
Web Browser Displaying Gogs SSH Keys

Gogs New Repo
Web Browser Displaying Gogs Repository Creation

Gogs Repo Summary
Web Browser Displaying Gogs Repository Summary

Gogs Clone Repo
Command Line Pushing To Cloning Gogs Repository

Gogs Repo Push
Command Line Pushing To Gogs Repository

Gogs Updated Repo Summary
Web Browser Displaying Gogs Updated Repo Summary

Gogs Commits
Web Browser Displaying Gogs Commit History

Screencast Of Gogs Setup

Level Up Your Programming Skills

Ready to take your development to the next level?

Professional Support and Tutorials

Need personalized help with your coding journey or a professional setup of your Git service?

Happy self-hosting!

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 *