Getting Started with Gitea: Self-Hosted Git with CI/CD using Podman

Self-Host Git + CI/CD
Self-Host Git + CI/CD

Live stream set for 2025-09-20 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.

Code hosting with Gitea: CI/CD with Gitea Actions

Are you looking for a lightweight, self-hosted Git service that is easy to set up and comes with built-in CI/CD support? Let me introduce you to Gitea – an open-source alternative to platforms like GitHub and GitLab.

In this post, we will explore what Gitea is, how you can install it using Podman (or Podman Compose), and how to use Gitea Actions for continuous integration. Whether you are a hobbyist, student, or seasoned developer, this guide is designed to help you get started.

What is Gitea?

Gitea is a community-managed lightweight code hosting solution written in Go. It is completely open-source and supports Git repository management, issue tracking, code review, and built-in CI/CD through Gitea Actions.

It is ideal for:

  • Small teams or solo developers
  • Learning Git in a self-hosted environment
  • Testing out CI/CD pipelines without relying on external platforms

Installing Gitea using Podman

Here is how to set up Gitea using Podman and Podman Compose on your local machine or server.

Prerequisites

  • Podman and Podman Compose installed
  • Root or sudo access

Step-by-Step Installation

Create a podman-compose.yml file:

version: "3"

services:
  gitea:
    image: gitea/gitea:latest
    container_name: gitea
    ports:
      - "3000:3000"
      - "2222:22"
    volumes:
      - ./gitea:/data
    environment:
      - USER_UID=1000
      - USER_GID=1000
    restart: always

Then run the following command:

podman-compose up -d

Visit http://localhost:3000 in your browser to complete the setup using the web interface.

Using Gitea Actions (CI/CD)

Once your Gitea instance is running, you can set up CI/CD pipelines using Gitea Actions. Although still experimental, it is functional and improving rapidly.

Example: Gitea Action Workflow for Python with requirements.txt

Let us build a simple CI pipeline that runs Python tests every time you push code to your Gitea repository.

1. Create a New Repository

In Gitea, click on New Repository, give it a name like my-python-project, and initialize it if you like.

2. Add Python Files

At minimum, create two files in your project:

app.py
test_app.py

app.py:

def add(a, b):
    return a + b

test_app.py:

from app import add

def test_add():
    assert add(2, 3) == 5

3. Create a requirements.txt File

This file tells the CI system what packages to install.

requirements.txt:

pytest

You can create this file manually, or generate it by running:

pip freeze > requirements.txt

In our case, we are just listing pytest to keep it simple.

4. Add the Gitea Workflow File

Inside your project folder, create the directory .gitea/workflows/ and inside that, create a file named test.yml.

.gitea/workflows/test.yml:

name: Python CI

on:
  push:
    branches:
      - main

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v3

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: 3.11

      - name: Install Dependencies
        run: pip install -r requirements.txt

      - name: Run Tests
        run: pytest

5. Push Your Code to Gitea

Use the command line to push your files to the Gitea repository:

git init
git remote add origin ssh://gitea@your-gitea-server:2222/your-user/my-python-project.git
git add .
git commit -m 'Initial commit with CI'
git push -u origin main

Replace the remote URL with your actual Gitea instance and repository path.

6. View Workflow Results

In Gitea, click on Actions to view the results. You can check logs, verify steps, and see test output.

Folder Structure Recap

Your project folder should look like this:

my-python-project/
│── app.py
│── test_app.py
│── requirements.txt
└── .gitea/
    └── workflows/
        └── test.yml

Screenshots and Screencast Tutorial

Compose YAML
Gnome Text Editor Displaying Podman Compose YAML File

Gitea Container
Command Line Podman Compose Building Gitea Container

Gitea Initial Configuration
Web Browser Displaying Initial Gitea Configuration

Gitea Installation
Web Browser Displaying Installation Wait Screen

Gitea Dashboard
Web Browser Displaying Dashboard Screen

Gitea User Profile
Web Browser Displaying User Settings Screen

Gitea Admin
Web Browser Displaying Admin Settings Screen

Gitea New Repo
Web Browser Displaying New Repository Screen

Gitea Repo Code
Web Browser Displaying Repository Code Screen

SSH Key Generation
Command Line Displaying SSH Key Generator

Gitea Add SSH Key
Web Browser Displaying Add SSH Key Screen

SSH Configuration
Gnome Text Editor Displaying SSH Configuration

Git Repo Clone
Command Line Displaying Git Clone Result

App.py
Gnome Text Editor Displaying App.py File

Test_app.py
Gnome Text Editor Displaying Test_app.py File

Test.yml
Gnome Text Editor Displaying Test.yml File

Git Push
Command Line Displaying Git Push Result

Gitea Repo Contributions
Web Browser Displaying Repository Contributions

Gitea Repo Code Commits
Web Browser Displaying Repository Code Commits

Gitea Repo Actions
Web Browser Displaying Repository Actions

Screencast Of Gitea Setup

Learning Resources

If you are new to Git, CI/CD, or DevOps, here are some resources I offer to help you get started and improve your skills:

Final Thoughts

Gitea gives you full control over your Git repositories and offers a clean user interface with useful features for modern development workflows. By combining it with Podman and Gitea Actions, you get a powerful and free self-hosted development platform.

If you have any questions or would like assistance setting up Gitea, feel free to get in touch.

Happy coding!

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 *