Self-Hosted Git Server with Gitea
Keep your code, configs and project files in private repositories on your own Pi, with a web interface, issues and pull requests.
Gitea is a light, open-source Git service with a familiar web interface. It is perfect for backing up your ESPHome configs, Home Assistant YAML and Pico code with full history.
Mission steps
Start Gitea
Save the compose file below and run docker compose up -d. Use an SSD or USB drive rather than the microSD card for the data folder.
Finish the installer
Open port 3000, keep SQLite for a small home server, set the server domain to the Pi's IP and create the admin account.
Add your SSH key
Paste your laptop's public key in your user settings. Clone over SSH on port 2222.
Push a project
Create a repository in the web interface and push an existing folder with git remote add and git push.
Mirror important repos
Use 'New Migration' to keep a mirror of public projects you depend on.
Code
services:
gitea:
image: gitea/gitea:latest
environment:
- USER_UID=1000
- USER_GID=1000
restart: unless-stopped
volumes:
- /mnt/ssd/gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "2222:22"Tip: test every script on the bench before installing it in a moving machine.
Questions
Can it run CI like GitHub Actions?
Yes. Enable Gitea Actions and register an act_runner; many GitHub Actions workflows run with few or no changes.
Gitea or Forgejo?
Forgejo is a community fork of Gitea and is set up almost the same way. Either works for a home server.