Docs / Self-Hosted Applications / Deploying Gitea: Lightweight Git Hosting

Deploying Gitea: Lightweight Git Hosting

By Admin · Feb 23, 2026 · Updated Apr 23, 2026 · 562 views · 2 min read

Why Gitea?

Gitea is a painless, self-hosted Git service. Think of it as a lightweight GitHub/GitLab that runs on minimal resources.

Feature Gitea GitLab CE Forgejo
RAM usage ~200 MB ~4 GB ~200 MB
Docker image ~100 MB ~2 GB ~100 MB
Written in Go Ruby/Go Go
CI/CD Gitea Actions Built-in Forgejo Actions
License MIT MIT (CE) MIT

Docker Installation

# docker-compose.yml
services:
  gitea:
    image: gitea/gitea:latest
    ports:
      - "3000:3000"   # Web UI
      - "2222:22"     # SSH
    volumes:
      - gitea_data:/data
    environment:
      - GITEA__database__DB_TYPE=postgres
      - GITEA__database__HOST=db:5432
      - GITEA__database__NAME=gitea
      - GITEA__database__USER=gitea
      - GITEA__database__PASSWD=gitea-password
      - GITEA__server__ROOT_URL=https://git.example.com/
      - GITEA__server__SSH_PORT=2222
      - GITEA__server__SSH_DOMAIN=git.example.com
    depends_on:
      - db
    restart: unless-stopped

  db:
    image: postgres:16-alpine
    volumes:
      - postgres_data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=gitea
      - POSTGRES_USER=gitea
      - POSTGRES_PASSWORD=gitea-password
    restart: unless-stopped

volumes:
  gitea_data:
  postgres_data:

Configuration Highlights

# /data/gitea/conf/app.ini
[server]
DOMAIN = git.example.com
SSH_PORT = 2222

[service]
DISABLE_REGISTRATION = true   # After creating your account
REQUIRE_SIGNIN_VIEW = true    # Private instance

[repository]
DEFAULT_BRANCH = main

[ui]
DEFAULT_THEME = gitea-dark

Gitea Actions (CI/CD)

Enable in app.ini:

[actions]
ENABLED = true

Create a workflow:

# .gitea/workflows/test.yml
name: Test
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
      - run: npm ci
      - run: npm test

Migrating from GitHub

Gitea has a built-in migration tool:

  1. Go to New Migration in the web UI
  2. Select GitHub as source
  3. Enter the repository URL
  4. Check "Mirror" if you want it to stay synced
  5. Click Migrate Repository

It imports issues, pull requests, labels, milestones, and releases.

Backup

docker exec -u git gitea-gitea-1 gitea dump -c /data/gitea/conf/app.ini

Tip Gitea is an excellent choice for private repositories, team projects, or as a GitHub mirror. It runs beautifully on a 1 GB Breeze.

Was this article helpful?