8e4ea8a6e62f38bb8a44b6a271963af33bae9162
Local Git Server
A self-hosted Git server powered by Gitea with a GitHub-style web interface, repository browsing, issues, pull requests, actions, releases, and SSH/HTTP Git access.
Start it
- Copy
.env.exampleto.env. - Change
POSTGRES_PASSWORDin.envto a long random value. - Start the stack:
docker compose up -d
- Open http://localhost:3000.
- Create the first account. The first account becomes an administrator.
The Git SSH endpoint is available on port 2222:
git clone ssh://git@localhost:2222/your-user/your-repository.git
HTTPS cloning is also available from the repository page:
git clone http://localhost:3000/your-user/your-repository.git
Useful commands
# View service logs
docker compose logs -f gitea
# Stop containers but keep repositories and database data
docker compose down
# Stop and permanently delete all Git data
docker compose down -v
Production notes
- Put Gitea behind HTTPS with a reverse proxy before exposing it to the internet.
- Use a managed or separately backed-up PostgreSQL instance for important repositories.
- Set
DISABLE_REGISTRATION=trueandREQUIRE_SIGNIN_VIEW=truefor a private team server. - Back up both the
gitea_dataandpostgres_datavolumes. - Update
GITEA_ROOT_URLandGITEA_DOMAINto the public hostname before deploying.
Languages
Shell
100%