Document: WM-089 P. Webb Category: Self-Host 2026-04-17 Self-hosting my code with cgit (again) Abstract cgit is basic but it works well...perfect. Body Of all the code forges available, cgit[1] is the most basic but also the least offensive to me, stylistically (and customizable). Last weekend I planned to spin up a website for my photography but felt a sudden urge to get my public repos off Github. A few hours later, code.webb.page[2] was live. My original plan for hosting my repos was to wait until EOL[3] was ready but my roadmap doesn't have that happening anytime soon. 📸[the codex][IMG1] I setup a repo[4] with all my cgit customizations. Organizing the CSS[5] alone took a few days, thank goodness nesting exists (inlined my uchū palette[6] as well). ## Installation I always start with this handy script[7] for my servers. ```sh apt install cgit fcgiwrap python3-markdown -y ``` cgit needs `fcgiwrap` and if you want to have READMEs appear in your repos, you'll need `python3-markdown` (per the `readme=:` lines in `cgitrc`[8]). Also, I had to edit `about_formatting.sh`[9] to make relative imagess appear in my READMEs. Replace this: ```sh *.markdown|*.mdown|*.md|*.mkd) exec ./md2html; ;; ``` With this: ```sh *.markdown|*.mdown|*.md|*.mkd) ./md2html | sed 's|src="\./|src="/'"$CGIT_REPO_URL"'/plain/|g'; ;; ``` 📸[uchū readme][IMG2] `fcgiwrap.socket` should be owned by Caddy. Open with: ```sh systemctl edit fcgiwrap.socket ``` ```sh [Socket] SocketUser=caddy SocketGroup=caddy SocketMode=0660 ``` And enable with: ```sh systemctl enable --now fcgiwrap.socket ``` After updating your `Caddyfile`[10]'s `reverse_proxy`: ```sh chown caddy:www-data /run/fcgiwrap.socket ``` And reload! ```sh systemctl reload caddy ``` I like my repos' default branch to be `primary` and I made it so via: ```sh git config --global init.defaultBranch primary ``` I ran into issues making clone URLs pretty but still useable for me so I disabled them. You can download the repos via the `/commit` page in `tar.gz` and `zip` though. If you do go through the process of changing which users owns the main repo directory, you'll have to reload `fcgiwrap` to pick up the group change. ```sh systemctl restart fcgiwrap ``` Because I like having my repos organized, I have to update `cgitrc` when adding new ones. Not too bad of a deal-breaker, I'm doing everything else manually anyway (and it's a one-time thing). ## FIN I think that's it! I'm gonna keep tinkering with the styling here and there (the Markdown rendering isn't to my liking) and the structure (the generated HTML would look nicer if indented when you view source on the browser). I still have a number of repos on Github, most of them old and thus inconsequential. cgit is just a repo viewer so it lacks support for private repos; so, I'm not fully off Github yet. EOL can't come soon enough! 🕸️ References [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [IMG1] [IMG2]