Video tutorial coming soon.
🐙 Setup Gitea — Self-Hosted Git Service
Deploy Gitea on Ubuntu with Docker — a lightweight, blazing-fast self-hosted Git platform with repositories, issues, pull requests, wiki, and CI/CD hooks. Your own GitHub, fully under your control.
📦 Resources & Setup Scripts
Grab the automated bash script from GitHub to follow along with the video.
Quick Install:
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/dev/gitea/gitea-ubuntu.sh
chmod +x gitea-ubuntu.sh
sudo bash gitea-ubuntu.sh
Tutorial Steps
1 Download & Run the Script
The script installs Docker, starts Gitea with a PostgreSQL database, and configures SSH access on port 2222.
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/dev/gitea/gitea-ubuntu.sh
chmod +x gitea-ubuntu.sh
sudo bash gitea-ubuntu.sh
2 Complete the Setup Wizard
Open your browser and navigate to Gitea. You'll see the initial setup wizard — confirm your database settings and create the admin account:
http://<your-server-ip>:3100
3 Create Your First Repository
After login, click the "+" icon and create a new repository. You can initialize it with a README, choose a license, and set visibility (public or private). Clone it using the HTTP or SSH URL shown on the repo page.
4 Configure SSH Access
Add your SSH public key under Settings → SSH Keys. Then clone repositories via SSH on port 2222:
git clone ssh://git@<your-server-ip>:2222/username/repo.git
Ports Used
| Port | Purpose |
|---|---|
| 3100 | Gitea Web UI & HTTP Git |
| 2222 | Gitea SSH Git Access |
Overview
Gitea is a lightweight, self-hosted Git service written in Go. It provides a GitHub-like interface for repository management, code review, issue tracking, and project wikis. Gitea is extremely resource-efficient — it runs comfortably on a 512 MB RAM VPS — making it ideal for self-hosted DevOps on a budget.
Why Use It
Gitea gives you a complete GitHub-like development workflow — repositories, pull requests, code review, issues, wikis, and CI webhooks — with zero per-seat cost and full data ownership. It runs on 512 MB RAM, which means you can host it on the cheapest VPS tier alongside other services. For teams that don't want code on GitHub (IP concerns, compliance, air-gapped networks), or individuals who want a private forge for personal projects, Gitea is the most resource-efficient choice available.
When You Need It
Who Should Use It
Real Use Cases
Main Features
How to Use After Installation
Security Best Practices
Ports and Firewall Notes
Gitea runs on port 3000 (HTTP) and optionally 22 (SSH for git). Put it behind Nginx Proxy Manager on HTTPS port 443. If you use SSH git cloning (git@), expose port 22 or a custom SSH port and configure Gitea's SSH settings. The web UI and HTTPS git operations only need port 443. Port 3000 should never be exposed directly to the internet — only Nginx should reach it.
Backup and Maintenance
Common Mistakes
Troubleshooting
Alternatives
Forgejo is the most active Gitea fork — community-governed, compatible with Gitea data, and more actively maintained than Gitea as of 2024. GitLab is far more feature-complete (built-in CI, container registry, SAST) but requires 4+ GB RAM minimum. Gogs is Gitea's predecessor — simpler but less maintained. GitHub and GitLab cloud are excellent choices if you don't need self-hosting. Soft-serve is a terminal-focused minimal Git server for SSH-only workflows.
When Not to Use It
Avoid Gitea if you need built-in CI/CD without deploying a separate tool — GitLab CE includes its own CI runner. Don't use Gitea if your team is already happy on GitHub and there's no compliance or privacy reason to self-host — the operational overhead isn't worth it. Gitea also lacks advanced security scanning (SAST/DAST), dependency vulnerability tracking, and compliance audit logs that GitLab Enterprise provides. For large organizations with 100+ developers, GitLab or GitHub Enterprise may justify their cost.
Need Help Setting Up Gitea?
PrismaTechWork provides end-to-end infrastructure services — from initial deployment and security hardening to ongoing monitoring, automated backups, and dedicated support. Whether you need a single-server setup or a multi-site network, our team ensures your infrastructure is built right, secured properly, and maintained reliably.
Frequently Asked Questions
What is the difference between Gitea and Forgejo?
Forgejo is a community fork of Gitea created in 2022 when concerns arose about the Gitea governance and commercialization direction. Forgejo is fully compatible with Gitea data and APIs, is more actively maintained by the community, and has taken a stronger stance on open governance. Both are excellent choices; Forgejo is currently recommended for new deployments by many in the self-hosting community. Both import from and export to each other without issue.
How do I set up Gitea with Woodpecker CI?
In Gitea, go to Settings > Applications > OAuth2 Applications and create a new app with the Woodpecker callback URL (https://woodpecker.yourdomain.com/authorize). Copy the client ID and secret. In your Woodpecker docker-compose.yml, set WOODPECKER_GITEA=true, WOODPECKER_GITEA_URL, WOODPECKER_GITEA_CLIENT, and WOODPECKER_GITEA_SECRET. Start Woodpecker and log in — it will authenticate through Gitea automatically.
Can I mirror a GitHub repository to Gitea?
Yes. In Gitea, click + > New Migration > GitHub. Enter the repository URL and optionally a GitHub token for private repos. Enable 'Mirror this repository' to keep it auto-synced. Gitea will pull new commits, branches, and tags from GitHub on a configurable schedule. This is useful for backing up important public repos, working offline, or caching dependencies.
Does Gitea support large file storage (LFS)?
Yes, Gitea has built-in Git LFS support. Enable it in app.ini under [server] and [lfs] sections (or in the Docker environment variables). LFS objects are stored in Gitea's data directory by default. You can also configure Gitea to use an S3-compatible object store for LFS, which is recommended for large repositories with many binary assets.
How do I migrate from GitHub to Gitea?
Use Gitea's built-in migration tool: click + > New Migration > GitHub. This imports repositories with issues, pull requests, labels, milestones, comments, and releases. For each collaborator, they need a Gitea account to be mapped. After migration, update your local git remotes: git remote set-url origin https://gitea.yourdomain.com/org/repo. Update any CI/CD webhooks and deploy key registrations.
Can I use Gitea as an OAuth2 identity provider for other apps?
Yes. Gitea supports acting as an OAuth2 provider. In Site Administration > Applications, create an OAuth2 App for each application that should use Gitea login. Woodpecker CI, Grafana, and many other apps support Gitea OAuth2 natively. This means your team only maintains one set of credentials — Gitea becomes your internal SSO for self-hosted tools.
How do I update Gitea safely?
Run gitea dump first to create a full backup. Then pull the new Docker image: docker compose pull && docker compose up -d. Gitea runs any necessary database migrations automatically on startup. Check the release notes for breaking changes — major version upgrades sometimes require manual steps. Keep at least the last 2 backups before upgrading so you can roll back if needed.
Is Gitea suitable for a team of 50 developers?
Yes, Gitea handles 50+ developers comfortably on modest hardware (2 vCPU, 2 GB RAM). The Go runtime is highly concurrent and Gitea has been used in production at much larger scales. For high-concurrency teams, use PostgreSQL instead of SQLite as the database and ensure repository data is on fast SSD storage. Gitea's resource efficiency is one of its main advantages over GitLab for medium-sized teams.
