Gogs: self-hosted Git service

Gogs: setting up self-hosted GitHub clone

Forget scripto-Perlo-C porridge to setup web interface for Git! Forget installing thousands of dependencies to setup your own repository hosting! Gogs is here to make your life easier!

Gogs is a GitHub clone written in Go, which you can host on your own server. It’s a web interface to Git repositories plus a simple bug tracker. Gogs is very easy to install and use.

Gogs: GitHub clone

Installing Gogs

Gogs is distributed as a single statically linked binary plus a collection of configs and auxiliary files.

Gogs distribution: binary and auxiliary files.

All you need to do is download the distribution, unpack it and run gogs web to start the web server.

Running gogs web server.

Then go to localhost:3000 to open a one-page installation:

Gogs installation page

Set database type to SQLite — it’s a good fit for websites with small to medium traffic, and since it’s embedded, there’s not need to configure any database servers. Fill in other details (in most cases you can leave the defaults) and create a new admin account. That’s it! You now may want to:

Disabling public access

If you’re setting up repository hosting for your private projects, probably you’ll want to lock it down so that signing in with password is required to view anything there. To do so, open Gogs directory, find custom/conf/app.ini (note that it’s in the custom directory, do not edit conf/app.ini from the root one) and edit two values in [service] section, changing them to true:

; Does not allow register and admin create account only
DISABLE_REGISTRATION = true
; User must sign in to view anything.
REQUIRE_SIGNIN_VIEW = true

The first one disables public registration, making admin responsible for creating users manually if needed; the second one requires users to sign it to view any repositories.

Using Gogs

If you know how to use GitHub, you already know how to use Gogs! It reimplements most of the GitHub features: users, organizations, issues with labels and milestones, cloning via SSH and HTTPS. Unfortunately, one major feature that’s currently missing is pull requests, but Gogs developers plan to implement it in the future.

gogs-demo

Try it

There is a demo server running at https://try.gogs.io, feel free to register there and experiment with it. Click Explore if you want to browse existing repositories.

Security

A word of caution and a splash of cold water to cool off your excitement: Gogs recently had SQL injection vulnerabilities. They were fixed, but string concatenation in the SQL query with user supplied data is kinda unacceptable these days. I hope developers will take security more seriously.

Project and source code

Website: http://gogs.io
GitHub: https://github.com/gogits/gogs/
Authors: see http://gogs.io/team
License: MIT.

Learn Go

Programming in Go: Creating Applications for the 21st Century

Leave a Reply

Your email address will not be published. Required fields are marked *