selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

Gogs logo

Self-host Gogs

v0.14.3

Lightweight Git hosting with issues, PRs and wikis

ReleaseOpen SourceMIT
Updated4 months ago
LanguageGo
Setup difficultyEasy
Stars
47 929
CPU
2 CPU cores
RAM
512MB
Ports
3000 (HTTP server for the web UI, REST API and Git over HTTP), 2222 (Builtin SSH server for Git over SSH (enabled with START_SSH_SERVER))
Requires
Git
Docker
gogs/gogs
Install with Docker

What is Gogs?

Gogs is a Git forge written in Go that lets you run your own repository hosting, code review and collaboration stack on hardware you control. It is distributed as a standalone binary for Linux, macOS, Windows and ARM boards, and also as container images, while repository metadata can live in PostgreSQL, MySQL, MariaDB or SQLite and clones are served over SSH, HTTP and HTTPS. Each repository gets issues, pull requests, a wiki, protected branches, deploy keys, Git hooks, Git LFS and outbound webhooks in Slack, Discord or DingTalk shapes; whole hosts can be migrated or mirrored from other code hosting services. People can sign in with a local account, LDAP, SMTP, PAM, a trusted reverse-proxy header, or a GitHub.com and GitHub Enterprise account. A web editor handles quick file and wiki changes, notebooks and PDFs render inline, and the interface is translated into more than 31 languages. Operationally you write your own app.ini under a custom/ directory, run the server as a systemd unit or container, and use the same binary's gogs command for maintenance such as creating users, running git gc, backing up and restoring. The REST API is described as experimental, and the older privileged Docker image is being superseded by a non-root one. Setup guides, an API reference and a live demo instance are on the project site.

Gogs alternatives

Should you self-host Gogs?

Gogs scores 79/100 on selfhost.directory (how scoring works) and ranks #3 of 15 in Code Hosting. It has 47 929 GitHub stars, +68 in the last 30 days.

It shipped 6 stable releases in the past year. The latest, latest-commit-build, came out on 17 June 2026.

Setup is easy: most people get it running in one sitting. An official Docker image is available. It is MIT-licensed and written mostly in Go.

Its closest alternative on selfhost.directory is Gitea (89/100, 59 010 stars). It scores higher overall, so compare the two before you pick. See Gogs vs Gitea side by side.

Features

  • Backup and Restore
  • Issue Tracking
  • Localization
  • Notebook and PDF rendering
  • Protected branches
  • Pull Requests
  • Repository migration and mirroring
  • REST APIProject describes API support as experimental.
  • User and organization management
  • Web-based file editor
  • Webhooks
  • Wiki

Gogs README

Gogs Gogs
GitHub Workflow Status Sourcegraph

How to install Gogs

Install Gogs with Docker

Environment variables
GOGS_DATABASE_PASSWORD, GOGS_SECURITY_SECRET_KEY

$ docker volume create --name gogs-data $ docker create --name=gogs -p 10022:2222 -p 10880:3000 -v gogs-data:/data gogs/gogs:next-latest $ docker cp app.ini gogs:/data/gogs/conf/app.ini $ docker run --rm -v gogs-data:/data alpine chown -R 1000:1000 /data/gogs/conf $ docker start gogs

Two images are published: the modern non-root next-generation one (tag next-latest, becomes the default at 0.16.0) and the legacy root-privileged one with more container options.

How to configure Gogs

  • RUN_MODERun mode set at the top level of app.ini, e.g. prod for production.

    values: prod

  • RUN_USEROS user the Gogs process runs as.
  • EXTERNAL_URL[server] Public URL users reach the instance at; must match the real address, including https when a reverse proxy terminates TLS.
  • DOMAIN[server] Hostname used to build clone URLs and the default EXTERNAL_URL.
  • PROTOCOL[server] HTTP protocol Gogs listens with; keep http when a proxy does TLS termination.

    values: http, https

Gogs releases & version history

@ Every self-hosted release, weekly

One Monday email with the week's stable releases across the directory.

FAQ

Why can't I create a wiki for my mirrored repository?

Mirrors are read-only copies, so they cannot own a wiki. Either edit the wiki upstream, or convert the mirror into a regular repository under Settings > Danger Zone.

How do I give Git hooks permission to users?

Toggle the Git hooks permission for a user in Admin Panel > Users; because it allows arbitrary code execution on the server it should only be given to fully trusted users.

How do I reset a forgotten administrator password?

Stop Gogs, create a temporary admin account on the command line with gogs admin create-user, restart, then set a new password for the original admin through Admin Panel > Users and delete the temporary account.

How can I become an administrator?

The first registered account (ID 1) is made an administrator without needing email confirmation; afterwards admins promote others from Admin Panel > Users.

How do I make a custom robots.txt?

Put a robots.txt file in the custom/ directory at the installation root and Gogs serves it at /robots.txt.

How do I run Gogs in offline mode or on an intranet?

Set OFFLINE_MODE = true in the [server] section of app.ini, which turns off outside network calls such as CDN resources and Gravatar avatars.

What do I do if another service is already using port 3000?

Start the first run with a different port using the -port flag (for example gogs web -port 3001), then set the matching HTTP_PORT in your custom/conf/app.ini so restarts keep it.

More in Code Hosting

Rate this project

Click to rate — no account needed.

0 comments

Posting as guest
Loading comments…