💾 Archived View for idiomdrottning.org › hosting-git-repos captured on 2023-11-14 at 08:33:40. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-07-16)

➡️ Next capture (2024-02-05)

-=-=-=-=-=-=-

How to host git repos

In honor of World Give Up GitHub day, here’s a quick guide to how to serve up your own git repos.

In an empty directory readable from WWW (that has the URL you want your repo to have, for cloning) that you also can write to over SSH, run

git init --bare
mv hooks/post-update.sample hooks/post-update

Make sure the directory has the permissions you want for web (world readable, not writable).

Set the SSH path to the directory as a remote on your local copy of the repo, and push to it and you’re done.

Curiously, the files in the repo are not in there, for example people can’t go to https://your.server.whatever/foo/README even though your foo repo does have a README file. (Because this folder is a bare repo, it’s the same stuff that’s in a .git directory normally.) But you can put blog posts in there or whatever. Great for Bloxsom, Hugo, Jekyll type setups.

To push over https, you need a git aware https server, and that’s a more cumbersome topic for another day. With this quick and easy solution, you push over ssh (or even locally, if your working repo is on the same server as your web werver).

Update

All y’all asking what this hook does, make sure that the post-update file contains

exec git update-server-info

(And blank lines and comments.)

To find out what that git command does, git update-server-info –help (tl;dr: it updates packs and refs.)