Created Friday 02 December 2022
Recently I set up read-only Git repository hosting on Dreamhost for my project JACL. This was kind of tricky, so here are the steps:
cd into the directory corresponding to your hosted domain.mkdir your-repo.gitcd your-repo.gitgit init --barecp hooks/post-update.sample hooks/post-updategit remote add origin ssh://user@northbend.dreamhost.com:/home/user/example.com/your-repo.git substituting user, northbend.dreamhost.com, and example.com with your particulars.git push -u origin mastergit push and anyone on the Internet should be able to git clone https://example.com/your-repo.gitOn shared hosting, git clone or git fetch over SSH can fail with errors like:
fatal: unable to create thread: Resource temporarily unavailablegit upload-pack: git-pack-objects died with errorfatal: early EOFThese errors are misleading. The repository is usually fine. The real issue is strict process and thread limits on shared hosting. When Git tries to pack objects with multiple threads, git pack-objects can exceed those limits and die.
Force single-threaded packing on the server:
git config --global pack.threads 1
Optional conservative memory limits that are often needed on shared hosts:
git config --global pack.windowMemory 10m
git config --global pack.packSizeLimit 50m
These settings are safe defaults for shared hosts and avoid the thread limit failures.
If SSH cloning still fails, fall back to:
git clone --depth 1)git bundle to transfer repositories when SSH cloning is unreliable