Skip to content

Gitea: Self-Hosted Git Service

Deploy Gitea with Pigsty’s Compose template and connect it to external PostgreSQL.

Gitea is a lightweight open-source Git hosting platform.

Pigsty’s app/gitea template uses external PostgreSQL mode by default. Configure the database through GITEA_DB_* values in .env.

Quick Start

cd ~/pigsty/app/gitea
vi .env         # check domain, ports, database settings
make up

Default endpoints:

  • Web: http://git.pigsty or http://<IP>:8889
  • SSH: <IP>:222

Database Preparation

bin/pgsql-user pg-meta dbuser_gitea
bin/pgsql-db   pg-meta gitea

Connection string example:

postgres://dbuser_gitea:[email protected]:5432/gitea

Reverse Proxy and Upgrades

Gitea 28 serves notifications at /-/ws. Enable WebSocket support on the Nginx portal:

infra_portal:
  gitea: { domain: git.pigsty, endpoint: "127.0.0.1:8889", websocket: true }

Before upgrading, back up PostgreSQL and /data/gitea together and record the running image digest. Restore matching database and file backups when rolling back. Gitea 28 defaults to removing completed Actions runs, logs, and artifacts after 400 days; check retention settings if those records need to be kept longer. See the Gitea 28 release notes.

Common Commands

make up
make log
make stop
make clean

References

Was this page helpful?