Why Gitea?

GitHub and GitLab are great, but sometimes you need to own your code hosting:

  • Privacy — Code stays on your servers, not a third-party cloud.
  • Lightweight — Runs on 200 MB RAM (GitLab needs 4+ GB).
  • GitHub Actions compatible — Reuse existing CI/CD workflows.
  • Free & open source — MIT licensed, no per-seat fees.

Prerequisites

  • Linux server with Docker (or Go 1.21+ for binary install).
  • At least 512 MB RAM (1 GB recommended).
  • A domain name for HTTPS access (optional but recommended).

Step 1: Deploy with Docker Compose

# docker-compose.yml
version: "3"
services:
  gitea:
    image: gitea/gitea:latest
    container_name: gitea
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - GITEA__database__DB_TYPE=sqlite3
    volumes:
      - ./gitea-data:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3000:3000"
      - "2222:22"
    restart: always
docker compose up -d

Access at http://your-server:3000. Complete the initial setup wizard.


Step 2: Migrate from GitHub/GitLab

  1. Click the + icon → New Migration.
  2. Select GitHub (or GitLab, Bitbucket, etc.).
  3. Enter the repository URL and a personal access token with repo scope.
  4. Check what to import: Issues, Labels, Milestones, Releases, Pull Requests.
  5. Click Migrate Repository.

Gitea preserves commit history, branches, tags, and issue numbers.


Step 3: Enable Gitea Actions (CI/CD)

Enable in Configuration

Add to gitea-data/gitea/conf/app.ini:

[actions]
ENABLED = true

Restart Gitea: docker compose restart

Install and Register a Runner

# Download act_runner
wget https://gitea.com/gitea/act_runner/releases/latest/download/act_runner-linux-amd64
chmod +x act_runner-linux-amd64

# Register with your Gitea instance
./act_runner-linux-amd64 register \
  --instance http://your-gitea:3000 \
  --token YOUR_RUNNER_TOKEN

# Start the runner
./act_runner-linux-amd64 daemon

Example Workflow (.gitea/workflows/ci.yml)

name: CI
on: [push]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: echo "Hello from Gitea Actions!"
      - run: npm test

Troubleshooting

ProblemSolution
Can’t push via SSHCheck SSH key in Settings, verify port 2222 is mapped, test with ssh -T git@server -p 2222
”Repository not found” on cloneVerify the repo URL includes the correct user/org and repo name
Migration fails with 401The access token is missing or expired; generate a new one with repo scope
Actions workflow not triggeringEnsure ENABLED = true in app.ini, runner is online, and .gitea/workflows/ directory is used
Database locked (SQLite)Switch to PostgreSQL for multi-user setups; SQLite doesn’t handle concurrent writes well

Summary

  • Gitea is a lightweight GitHub alternative running on minimal resources.
  • Migrate repos with the built-in migration tool preserving issues and PRs.
  • Gitea Actions is GitHub Actions compatible — reuse existing workflows.
  • Use PostgreSQL instead of SQLite for teams with 5+ concurrent users.