Installing Gogs on Windows [discontinued]

This article is unfinished and discontinued! It contains a lot of useful information, but will not lead you to the very end. The only reason, for which I wanted to install and use Gogs was the fact, that my programming model (Yii2-based) required me to have a really large number of private repositories (each for every component, that my applications are using). And storing them on GitHub was very expensive.

However, as of May 11, 2016 GitHub has announced an unlimited number of private repositories available for every paid plan. This rendered Gogs completely useless for me. But, in the same time, it was also a very relief for me, because even though a whole long year passed since I started writing this article, I have never actually even touched problem of reconfiguring Composer to use source other than GitHub (Gogs).

Feel free to use this article to learn more about Gogs and its installation on Windows, but keep in mind, that this artice is unfinished and pretty much likely will never be finished.

I simply love Gogs! With some effort, it gives you your very own local GitHub-like installation, that is:

  • open-source (free!),
  • blazing fast (response times at 5-25 ms level for local users) and
  • gives you possibility to host many private repositories, just-like-in-GitHub.

There is only one pain in the ass. While Linux-based installation is fairly easy, getting Gogs to Windows is painful. Simply, becasuse most of components, that Gogs uses are designed for Linux, not Windows.

I hope, that this article will help you pass the biggest bottlenecks, you may find and enjoy Gogs on Windows.

Gogs of course isn’t a real GitHub, which local installs starts with 5000 USD per year. But it is a free, open-source alternative, that mimics GitHub in probably anything, including duplicating original GitHub’s UI, look and feel to the maximum level, that copyrights allows.

Recipe list

What to you need is:

  • SSH server,
  • NSSM or similar, to run Gogs as system service (optional!),
  • MySQL or PostgreSQL database (these inside XAMPP seems good enough),
  • Git for Windows in version 1.7.1 or newer with GitBash installed (client).

These four elements are required for full installation of Gogs. However, you don’t need:

  • SSH server, if you are the only one user of Gogs or if you’re going to use HTTP/HTTPS access,
  • database on small load installations, because Gogs’ very own SQLite database should be fine in this case and
  • NSSM, if you don’t want to install Gogs as system service or if you’ll restart that service manually, once it gets down.

Of course, you’ll need Gogs itself! :> Here are all the binaries (for all systems and platforms) and here you’ll find detailed, binary-based Windows installation instructions, on which this article is based.

A detailed list of requirements for installing Gogs on Windows can be found here.

SSH Server

I’ve started with free edition of CopSSH. Unfortunately, even after spending few long days and exchanging a lot of e-mails with CopSSH’s support, I haven’t managed to get it working. Even after proper configuration (remember to use lowercase usernames for Windows account for CopSSH) and adding all required public keys, my user wasn’t correctly authorized. Regretfully, but I had to pass on this option.

If you want to give it a try, then continue to the following subchapter. If not, skip to second one.

Alternatively, you can use freeSSHd or any other SSH server, for example from this list. Gogs recommends Cygwin OpenSSH under Windows, which I personally hate (as entire Cygwin).


This SSH server comes in free and paid version. Free one is limited to 32-bit systems and only one, local user. Paid version is available for domain users or 64-bit platforms and offers way better support. CopSSH comes with nice installer, which takes care of everything (installation, pre-configuration, creation of necessary, separate Windows account, adding proper rules to Windows Firewall etc.) and an easy to use controll panel. Thus, it was really pity for me to resign from using it. But… I have no use of pretty installer and control panel, if software behind it is simply not working.

If you want to give it a try, even so, then continue reading this subchapter.

Install CopSSH by unpacking and executing installation .exe file. During install you will be asked to create a new local user with administrator privileges.

After installation run “CopSSH Control Panel” and:

  1. Make sure, that service is running.
  2. Go to Users tab and click Add and select proper user.
  3. Check Public key authentication only and choose Linux shell and Sftp.
  4. After activating this user, click Keys, then Import and add your public key or keys.

I wasted about 20 minutes, getting “Parsing problems during import operation. Operation is cancelled” error dozen of times, until I found this comment, which explained me, that you need to paste your public key including comment and ssh-rsa part, separated with spaces.

The only accepted format is something like ssh-rsa [public key] [comment or title]. For example:

ssh-rsa ACDDB7NzaC1yc2EAAAABJQAAAIEArxQrKaCatx/gW2Vt8Ou2rs7Mg/3hf4jDYtNUwSd8Vy5kQXhyjVYWCooDQeQl5i98iuBt50EqR+LBolIasLry4tRkV3z36z0oDWzdDaT5VezfyJayoxz+KrZw2L6Hj+c73SeXLLRZjzT8555o3PEaEAtem7S1VxXxstfKvA4zvCv= Git for Windows @ Home

Add as many public keys as you need and finish this process with clicking Apply.

You can now test your connection from any client , by executing ssh -T [user]@[host].

If you’re getting “ssh: connect to host [host] port 22: Bad file number” error, then your client is unable to connect to your CopSSH installation and most likely one of the routers in-between is not forwarding traffic on port 22. Enabling SSH traffic on this port or using other port should solve this problem.

If you’re getting “Permission denied (publickey,keyboard-interactive)” error, then it seems, that you haven’t added public key for that machine to your CopSSH configuration or you have provided an incorrect public key. This is the point, where I stucked permanently and uninstalled CopSSH.


If CopSSH is not an option, then alternatively you can use freeSSHd. Here are some resources:

First article is good for virtually any version of Windows, it is sharp (explains everything quickly without wasting your time) and includes information on adding public keys to freeSSHd and testing connection — some articles lack these. You really should start with this article.


For just testing or looking around, Gogs is ready out-of-the-box, following these instructions. Simply unpack the Windows binary .zip file anywhere, cd that destination in command line and run / execute gogs web command. Then point your browser to and follow first-run installer.

The Non-Sucking Service Manager

You can skip this part, if you don’t want to use Gogs as system service. If you do, you can get NSSM from here, while homepage of NSSM explains, why it is named “non-sucking” and why Microsoft alternative (srvany) sucks.

Leave a Reply