LIBERATION TOOLS ARMORY
Engineering deck access granted • Select your equipment
Escape GitHub: Self-Hosted Git with Gitea
Complete guide to migrating from GitHub to a self-hosted Gitea instance with full CI/CD capabilities
Mission Briefing
GitHub’s acquisition by Microsoft was the canary in the coal mine. Today’s “Copilot” suggestions are tomorrow’s mandatory AI reviews. It’s time to take back control of your code.
Why Gitea?
- Lightweight: Runs on a Raspberry Pi if needed
- Feature-Complete: Issues, PRs, CI/CD, packages, wikis
- Migration-Ready: Direct GitHub import tools
- Community-Driven: No corporate overlord
The Liberation Process
Phase 1: Infrastructure Setup
# Docker Compose deployment
version: '3'
services:
gitea:
image: gitea/gitea:latest
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__database__DB_TYPE=postgres
- GITEA__database__HOST=db:5432
restart: always
networks:
- gitea
volumes:
- ./gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "222:22"
depends_on:
- db
Phase 2: Data Migration
The migration tool preserves everything:
- Repositories with full history
- Issues and pull requests
- Wikis and project boards
- Stars and watches (as much as possible)
# Use Gitea's built-in migrator
gitea migrate --config /data/gitea/conf/app.ini \
--type github \
--url https://github.com/yourusername/yourrepo
Phase 3: CI/CD Liberation
Replace GitHub Actions with Gitea Actions (Drone CI compatible):
name: Build and Test
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run tests
run: |
npm install
npm test
Advanced Defenses
Federation via ActivityPub
Gitea is implementing ActivityPub support, allowing:
- Cross-instance collaboration
- Decentralized issue tracking
- Federated code search
Backup Strategies
# Automated backup script
#!/bin/bash
BACKUP_DIR="/backups/gitea"
DATE=$(date +%Y%m%d_%H%M%S)
# Backup database
docker exec gitea_db pg_dump -U gitea gitea > $BACKUP_DIR/db_$DATE.sql
# Backup repositories and data
tar -czf $BACKUP_DIR/data_$DATE.tar.gz /var/lib/gitea
# Sync to remote storage
rclone sync $BACKUP_DIR remote:gitea-backups/
Performance Optimization
With proper tuning, Gitea can handle:
- 10,000+ repositories
- 1,000+ concurrent users
- Sub-second page loads
Key optimizations:
- Enable Redis caching
- Use PostgreSQL over SQLite
- Configure proper indexing
- Enable Git LFS for large files
Cost Analysis
GitHub Enterprise: $21/user/month Self-Hosted Gitea: ~$20/month total for small team
- VPS: $10-15/month (Hetzner, Contabo)
- Backup storage: $5/month (Backblaze B2)
- Domain + SSL: $15/year
- Your time: Priceless freedom
Common Objections Debunked
“But GitHub has better uptime!” Your $10 VPS probably has better uptime than GitHub’s recent track record.
“What about discoverability?” Mirror to GitHub if needed. Keep the primary on your infrastructure.
“It’s too complex!” If you can deploy a Node app, you can run Gitea.
The Path Forward
- Start with private repos
- Migrate active projects gradually
- Keep GitHub as a mirror initially
- Cut the cord when comfortable
Remember: Every self-hosted instance is a beacon of resistance in the digital ocean.
Resources
“The best time to plant a tree was 20 years ago. The best time to self-host your code is now.”
"The right tool can dismantle any cage."