Host your Git on Glitch with Gogs
Tags: git, gogs, go, glitch
Published: 2020-01-22 17:43:34

---
title: Host your Git on Glitch with Gogs
published: true
description: Gogs is a self-hosted Git service written in Go (gee... that's a lot of of Gs), this is how we made it run on Glitch
tags: git, gogs, go, glitch
cover_image: https://thepracticaldev.s3.amazonaws.com/i/jxksdpx10jhateu3i8kr.png
---

Can it run on [Glitch](http://glitch.com?utm_medium=weblink&utm_source=dev.to&utm_campaign=blog&utm_content=dev)? That’s the question I ask myself every time I see someone mention a cool open source software project. A month or so I saw some discussion of [Gogs](https://gogs.io/), a self-hosted git service. It's basically a DIY version of GitLab, Bitbucket, or Github. 

The catch? Gogs runs in [Go](https://golang.org/). While Glitch can support almost any language, most of our features are tailored for [Node.js](https://nodejs.org/en/). So I was really curious if I could get it to run. We have a couple of sample Go projects like go-example and go-glitch-sample. To make a Glitch app use Go, you put in a special file called glitch.json. It tells Glitch that instead of running the default “npm start” when you open your project, to run whatever is defined as “start” in glitch.json

# TFW errors 😱

I installed Gogs from binary<sup>1</sup>.  And it seemed to work ok. But I hit a snag. There were so many directories in the project that they made the Glitch editor load much slower. So I hid them. To do this I moved to directories with a dot prefix like like “.scripts”. Voila, my Glitch project was much faster.

Then I tried installing and I got a weird error message “Run user isn't the current user: app ->” which didn’t give me much to go on. I tried a lot of random things and nothing worked. I finally went into the gogs codebase and found the line that error came from. It expected an environment variable called USER. I changed my start command in glitch.json to set that. 

# Our shiny new Gogs ✨
Gogs has many of my fav git hosting features like pull request reviewing and a visual interface for exploring the code and commits. 

![exploring the features of gogs](https://thepracticaldev.s3.amazonaws.com/i/jxksdpx10jhateu3i8kr.png)

It has some great features including:
* pull requests with a visual interface
* issues
* wikis
* forking

# Try it yourself? 🌠

I wanted to make this easy to [“remix”](https://glitch.com/help/remix/?utm_medium=weblink&utm_source=dev.to&utm_campaign=blog&utm_content=dev) which is a Glitch term for getting your own copy. So I added some files and directories to a file called .gitignore, so you won’t get my repositories when you get your own copy. I haven’t gotten email notifications working yet, but I might try [Sendgrid](https://glitch.com/~sendgrid-quickstart?utm_medium=weblink&utm_source=dev.to&utm_campaign=blog&utm_content=dev) for that. 

{% glitch apricot-lantana code %} 


If you try it out let us know what you think in the comments!


------
Footnotes:
1. I had to extract the binary on my own computer because it took up a lot of space. I used the 64 bit Linux one from [here.](https://gogs.io/docs/installation/install_from_binary). Then uploaded to Glitch. Because binaries end up in the [assets](https://glitch.com/help/how-do-i/) section on Glitch, I got the URL from the assets. Then I used `wget asset-url`. Finally I ran `chmod +x asset-file`