While setting things up for my blog, I used blogit, but I modified it a bit to suit my needs. And since I had some code, used a repo anyways and I wanted to host my own things, I started thinking about setting up my own git. I looked for different solutions to do so, and a few apps caught my attention, mainly Gogs. Then I also asked some people about their recommendations, and a couple of my friends told me about Gitea which turned out a fork of Gogs. After reading through a feature comparison, I decided that Gitea was the way to go. Now I only needed to host it!
Choosing installation type
Gitea offers a few types of available installations: using Docker, from binaries or from packages for various distros. I decided to go with the last one, since it already provides a systemd service, and I didn’t want to bother with writing my own. I won’t describe the installation process, since the docs are very good and the software might be updated thus obsoleting this description. But I will describe how I solved the couple of problems that I had.
SSH from behind a proxy
I personally use Cloudflare to cache my website and my git server. One very big issue with this approach is that I can’t use SSH like so:
ssh kavela.ch. This is a huge issue, since I don’t want to use the HTTPS method of authentication. So I just created a special
ssh.kavela.ch DNS record that points towards my server directly, bypassing Cloudflare. I know that this shows my IP address, but I don’t think someone will actually want to DDoS me. If they do, I’lll try to think about a different solution then.
After setting this up, you need to edit your configuration in Gitea
[server] SSH_DOMAIN = ssh.kavela.ch
and restart the server. UI should show you the appropriate address now 🙂
Git via SSH not working
If you have issues with using the repository with an SSH connection and you don’t use the SSH server that is provided by Gitea, you probably need to use the Update the ‘.ssh/authorized_keys’ file with Gitea SSH keys. and Update the ‘.ssh/authorized_principals’ file with Gitea SSH principals. in the admin dashboard. After using these, my problems went away.
Tags: english technical tutorial linux self-hosted