Setting Up Gitea as a Self-Hosted Git Server
If you don't already have a git server (GitLab, GitHub Enterprise, etc.), we recommend Gitea — a lightweight, self-hosted git service that runs in a single Docker container with minimal resources.
Requirements
Linux server (Ubuntu 22.04+ recommended)
1 GB RAM minimum
Storage: plan for at least 2x your total IDA database sizes
Docker
Step 1: Install Docker
sudo apt-get update
sudo apt-get install -y docker.io docker-compose-v2
sudo systemctl enable --now dockerStep 2: Configure and Start Gitea
mkdir -p /opt/gitea
cd /opt/giteaCreate a .env file with your server's IP address:
echo 'SERVER_IP=192.168.1.100' > .envCreate docker-compose.yml:
Docker Compose reads .env automatically. Start it:
Step 3: Initial Setup
Open http://<SERVER_IP>:3000 in a browser. Fill in the Administrator Account at the bottom of the setup page and click Install Gitea.
Step 4: Create a Repository
Log in and click + → New Repository. Give it a name and do not initialize it (no README, no .gitignore).
Optionally, create an Organization first (+ → New Organization) to group repositories under a shared namespace instead of a personal account. For example, with an organization named ida, repos are accessible as git@idbs-repo:ida/my-project.git.
Step 5: Configure SSH Access (for clients)
On each client machine that needs to push to Gitea, add an SSH host alias so that regular SSH to the server is not affected.
Edit your SSH config file:
Linux / macOS:
~/.ssh/configWindows:
C:\Users\<username>\.ssh\config
Add the following:
This maps the alias gitea to the server's SSH on port 2222. Regular ssh user@<SERVER_IP> connections remain on port 22.
Add the client's public SSH key in Gitea: User Settings → SSH / GPG Keys → Add Key.
Verify access:
Using a Dedicated Disk
To store repositories on a separate disk (recommended for large repos), mount it before starting Gitea and point the data volume to it:
Then update docker-compose.yml to use the mounted path:
Maintenance
All data lives in the data volume and survives container restarts and upgrades.
Troubleshooting
SSH connection refused
Verify the container is running and port 2222 is open:
Push rejected (protected branch)
Go to the repository Settings → Branches and remove branch protection.
Last updated
Was this helpful?
