Why Choose Gogs Over GitLab? A Lightweight Self‑Hosted Git Solution
This article introduces Gogs as a fast, low‑resource self‑hosted Git service, explains how to install it with Docker, configure basic settings, use it for a SpringBoot‑Vue e‑commerce project, and compares its advantages over GitLab for developers seeking a lightweight alternative.
Gogs Introduction
Gogs is an extremely easy‑to‑deploy self‑hosted Git service written in Go, boasting over 40k stars on GitHub and supporting Linux, macOS, Windows, and ARM platforms, even running on a Raspberry Pi.
Installation
Gogs can be installed in a Docker environment with just two commands.
Pull the Docker image:
<code>docker pull gogs/gogs:latest</code>Run the container:
<code>docker run -p 10022:22 -p 3000:3000 --name=gogs \
-v /mydata/gogs:/data \
-d gogs/gogs:latest</code>The
10022port maps to Gogs' SSH service,
3000to its HTTP service, and the
/mydata/gogsdirectory on the host stores persistent data.
Configuration
After starting, visit
http://192.168.3.101:3000to access the initial setup page.
Use the built‑in SQLite3 database for simplicity; other databases require manual setup.
Set the domain, SSH port, and application URL as needed.
Usage Example
Using a SpringBoot3 + Vue e‑commerce project (mall) as a practical example.
Project Overview
The mall project is a SpringBoot3 + Vue e‑commerce system with a microservice architecture, deployed via Docker and Kubernetes, covering features such as products, orders, carts, permissions, coupons, members, and payments.
Boot project: https://github.com/macrozheng/mall
Cloud project: https://github.com/macrozheng/mall-swarm
Video tutorial: https://www.macrozheng.com/video/
Repository Migration
Use the “Migrate external repository” option to import the mall project from Gitee (https://gitee.com/macrozheng/mall). After migration, the repository page remains clean and simple.
Cloning
Click the copy‑link button to obtain the clone URL, then use IDE’s Git checkout feature to clone locally.
Issue Management
Gogs provides an Issue‑like feature; click “Create Issue”, fill in title, content, and labels, then submit.
User Management
Admins can create new accounts via the user management interface and assign appropriate permissions.
Collaborator Management
In repository settings, add collaborators by entering their usernames and setting access rights.
Gogs vs. GitLab
Compared with GitLab, Gogs has a much smaller Docker image (~100 MB vs. ~1500 MB), faster startup (seconds vs. minutes), lower hardware requirements (can run on a Raspberry Pi), and a simpler feature set, while GitLab offers richer functionality but consumes more resources.
Conclusion
Gogs is a solid, lightweight self‑hosted Git service suitable for most code‑hosting needs; pairing it with CI/CD tools like Drone or Jenkins can provide additional capabilities while keeping the system lean.
Project Repository
https://github.com/gogs/gogs
macrozheng
Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.