Scripts2026年4月16日·1 分钟阅读

Gogs — Painless Self-Hosted Git Service

Gogs is a lightweight, self-hosted Git service written in Go. It runs on minimal hardware, supports multiple platforms, and provides a GitHub-like experience with issue tracking, pull requests, and webhooks.

Introduction

Gogs is a self-hosted Git service built with Go that aims to be the easiest and most painless way to set up your own code hosting. It runs anywhere Go compiles — Linux, macOS, Windows, ARM — and needs as little as a Raspberry Pi to operate.

What Gogs Does

  • Hosts Git repositories with a clean web interface for browsing, commits, and diffs
  • Provides issue tracking, milestones, and labels for project management
  • Supports pull requests and code review workflows
  • Offers built-in wiki, webhooks, and Git hooks for automation
  • Manages organizations and teams with fine-grained repository permissions

Architecture Overview

Gogs is a single Go binary embedding a web server (Macaron framework), a Git command wrapper, and an ORM (XORM) that supports SQLite, MySQL, PostgreSQL, and MSSQL. Static assets and templates are compiled into the binary for zero-dependency deployment. The architecture prioritizes simplicity — one process handles HTTP, SSH, and background tasks without requiring Redis, Memcached, or external workers.

Self-Hosting & Configuration

  • Deploy via binary, Docker, or package managers on Linux, macOS, Windows, and ARM
  • Configure via app.ini covering server, database, mailer, session, and security settings
  • Supports SQLite for zero-setup or MySQL/PostgreSQL for production scale
  • Built-in SSH server or use system SSH with custom key management
  • Reverse-proxy friendly with Nginx or Caddy for TLS termination

Key Features

  • Extremely lightweight — runs on 512 MB RAM and minimal CPU
  • Single binary deployment with no external service dependencies
  • Built-in Markdown rendering, syntax highlighting, and file editor
  • Repository mirroring for syncing with upstream repositories
  • Two-factor authentication and LDAP/PAM/SMTP login sources

Comparison with Similar Tools

  • Gitea — Fork of Gogs with more features and faster development pace, but heavier
  • GitLab CE — Full DevOps platform with CI/CD, but requires significantly more resources
  • OneDev — Feature-rich with built-in CI, but more complex setup
  • Forgejo — Community fork of Gitea focused on governance, similar resource profile

FAQ

Q: How does Gogs differ from Gitea? A: Gitea forked from Gogs in 2016 and added many features. Gogs remains focused on simplicity and minimal footprint, while Gitea offers more enterprise features at the cost of higher resource usage.

Q: Can Gogs run on a Raspberry Pi? A: Yes. Gogs is one of the lightest Git hosting solutions available, running comfortably on ARM devices with as little as 512 MB of RAM.

Q: Does Gogs support CI/CD? A: Gogs does not include built-in CI/CD but supports webhooks to trigger external CI systems like Drone, Jenkins, or Woodpecker CI.

Q: Can I migrate from GitHub or GitLab to Gogs? A: Yes. Gogs supports repository mirroring and provides a migration tool for importing repositories, issues, and labels from other platforms.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产