commit 2bd8f70f8c431276c718fbc89342329cf4492ba3
parent 1d07c06c5de80d5b3e0852a1de00033278b5fc75
Author: Michael Neuper <michael@michaelneuper.com>
Date: Wed, 28 Oct 2026 11:39:41 +0200
serve repos for cloning over dumb HTTP
Diffstat:
4 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml
@@ -42,6 +42,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
GITHUB_USER: ${{ github.repository_owner }}
SITE_URL: https://git.michaelneuper.com/
+ SERVE_GIT: 1
# wrangler needs Node 22 or newer.
- uses: actions/setup-node@v7
diff --git a/README.md b/README.md
@@ -46,9 +46,11 @@ skipped. Environment variables:
- `SITE_URL`: public URL with trailing slash, used to make the Atom feed
links absolute.
- `SERVE_GIT=1`: also publish the bare repos, so that
- `git clone <SITE_URL><repo>.git` works over git's dumb HTTP protocol. It's
- off for git.michaelneuper.com because one of the repos has a packfile over
- 100 MB, and Cloudflare doesn't serve static files over 25 MiB.
+ `git clone <SITE_URL><repo>.git` works over git's dumb HTTP protocol, and
+ use that as the clone URL on the repo pages. Each repo is first repacked
+ into packs of at most 20 MiB, because Cloudflare doesn't serve files over
+ 25 MiB. A single file over 25 MiB can't be split, so a repo with one
+ fails the deploy. The workflow sets it.
stagit writes into the current directory, so to render a single repo
without a full build:
@@ -72,8 +74,8 @@ To deploy your own copy:
1. Put your hostname in `wrangler.jsonc` and `SITE_URL` in the workflow,
and list any repos to skip in `exclude`. The domain must be a Cloudflare
- zone. The first deploy points the hostname at the Worker, replacing any
- existing DNS record for it, and sets up HTTPS.
+ zone without DNS records for that hostname: the deploy creates its own
+ record and HTTPS certificate, but fails if another record is in the way.
2. Create a Cloudflare API token from the "Edit Cloudflare Workers"
template, and add it and your account ID as repository secrets:
diff --git a/build.sh b/build.sh
@@ -89,6 +89,14 @@ while IFS=$us read -r name branch lang desc <&3; do
)
if [ "$serve_git" = 1 ]; then
+ # Cloudflare doesn't serve files over 25 MiB, so split the
+ # objects into packs of at most 20 MiB. Split packs can't have
+ # a bitmap, and dumb HTTP doesn't use one. Recomputing deltas
+ # on one thread makes the packs depend only on the objects,
+ # not on the pack GitHub sent, so unchanged repos don't get
+ # uploaded again.
+ git -C "$repo" -c pack.threads=1 repack -q -a -d -f \
+ --max-pack-size=20m --no-write-bitmap-index
git -C "$repo" update-server-info
cp -R "$repo" "$out/$name.git"
fi
diff --git a/exclude b/exclude
@@ -1,2 +1,3 @@
# Repos to leave out of the mirror, one name per line.
# Forks, private and empty repos are always skipped.
+michaelneuper