While Nextcloud is nifty for keeping files synchronized across multiple computers. It doesn't handle git archives well. And while I could just use git over ssh, the web-based front ends add some interesting features including:
- web-based editing
- big-picture views of when files changed
- ability to download or pull stuff without ssh.
Gitea seemed like an interesting project that covers most of what I need with a minimal footprint. This unfortunately led me down a rabbit hole of issues that probably would have been fixed if I just bothered to read the manual. Some findings:
Put the gitea binary in your data directory.
Most of what I'm used to involves the standard unix layout. Executable files live in some variant of
/usr/local/bin. Most configuration files live in
/usr/local/etc. Data goes somewhere under
/var. Gitea likes to put data in the same directory where the executable lives and fails (without error) if it can't write there. So the gitea executable on my system lives in
First run to set up the config files.
To set everything up, run
sudo -u git /home/git/gitea web. Gitea will run a web server at
http://localhost:3000/ (I had to open a hole in the firewall and log in via ip number). That will take care of most settings including the URL you want to run gitea at. Mine runs under a sub-url of
https://hostname.com/gitea. I'm using sqlite3 for my database backend since I plan on being the only user.
After that, you want to create your first admin user by registering.
After the first run, I got into the generated config file to set some other options.
Set gitea to be available at
[server] ... ROOT_URL = https://hostname.com/gitea/
Enable the gitea ssh server because I couldn't get openSSH integration working. I picked an arbitrary port number for gitea to listen for ssh connections:
[server] ... SSH_PORT = 7124 START_SSH_SERVER = true
Disable registration (since I'm the only user) and require login to view anything:
[service] ... DISABLE_REGISTRATION = true REQUIRE_SIGNIN_VIEW = true
Configuring apache as a proxy server was another pain in the ass that could have been handled by RTFM.
ProxyPreserveHost On ProxyRequests off ProxyPass /gitea http://hostname.com:3000 ProxyPassReverse /gitea http://hostname.com:3000 RewriteRule ^/gitea - [QSA,L]
Use the template in the contrib folder for gitea. Hopefully everything will run, and with a few repos added, the result should look something like this: