Github is probably the most popular git repository hosting platform. But unfortunately Github itself is not open source and cannot be installed on your own server. This is where Gogs enter.
Gogs, for Go Git Service, is an opensource self hosted git repository hosting platform under MIT license. Written in Go, Gogs, is easy to install (Either with docker or with binaries), lightweight (minimal requirements).
Through a web interface, it allows you to share, manage and control the revision of your source code with different access rights for different people and several collaborative features (bug tracker,…).
Gogs is also multi-platforms (Can run on Windows, MacOS and Linux type of systems). They accept MySQL, PostgreSQL and SQLite as database and can run on Apache or Nginx. Quite flexible then.
You can directly try their demo version or follow the below installation steps to run your own instance of gogs on your server.
Gogs offers various binary packages for Debian, Ubuntu, CentOS and even Arch. So the installation will be straightforward.
1) Add their repository to your source.list
As they use HTTPS connections to their repository, you will need to install apt-transport-https.
In root (or with sudo in front), run:
apt-get install apt-transport-https
Then add their repository with the following commands:
wget -qO - https://deb.packager.io/key | apt-key add - echo "deb https://deb.packager.io/gh/pkgr/gogs wheezy pkgr" | tee /etc/apt/sources.list.d/gogs.list apt-get update
2) Install Gogs
apt-get install gogs
It will install the latest available version and start the service automatically. Gogs will run behind the port 6000 but will need to be accessible with the port 80 (or 443 if you prefer).
3) Create a dedicated virtualhost
If you simply try to access http://yourIP:6000, your web-browser will block the connection. My Iceweasel (Firefox) is saying:
“This address uses a network port which is normally used for purposes other than Web browsing. Iceweasel has canceled the request for your protection”. This is because I must create a proxypass from the port 6000 to 80, in order to let my web-browner render the service.
You will first need to install the mod-proxy-html
apt-get install libapache2-mod-proxy-html
while you will also need to activate the mod-proxy-http (Already installed)
Then you can configure your virtualhost. Make sure to create a A or CNAME redirection in your DNS registrar.
Here is a simple virtualhost you can reuse:
Still in root:
and copy paste:
<VirtualHost *:80> ServerAdmin firstname.lastname@example.org ServerName gogs.domain.tld ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://localhost:6000/ ProxyPassReverse / http://localhost:6000/ </VirtualHost>
Simply restart your apache service
and you’re good to browse http://gogs.domain.tld to access to the web installer.
You should now have access to Gogs’web installer.
– You will need to set up a database (Either MySQL, PostgreSQL or SQLite). In my case, I’m using MySQL and I’ve created a dedicated database/user/password through PHPMyAdmin.
– You will also need to set-up a local directory for your git projects, gogs user (default one should work) and application URL (The one you are using right now)
– SMTP settings (Optional)
– Admin account
When done, you should be able to use Gogs right away along with all your favorite git commands.