HACKER Q&A
📣 philshem

Why can't Git be serverless?


I had asked this as a comment[0], but I feel like with one exception [1], the answers all say "ssh to a git server" which is not a remote filesystem based git-like process on each client. Indeed, the simplicity of ssh and git probably makes the below steps overly complicated. But I was thinking for personal micro-projects, that someone doesn't want hosted on a platform (github, gitlab), and doesn't want to pay & operate a VPS.

Instead of referring to the existing functionality "git", let's call this hypothetical example "git+".

Here's the concept:

+ a remote filesystem stores the files of a git+ repository (e.g. cloud Bucket accessed via rsync/rclone)

+ each git+ client contains extra functionality from a normal "git" server, including functionality from the "--bare" option, but runs entirely on the client (or as a cloud function).

+ the first step of every git+ process would be to create a .LOCK file, that prevents other users from writing concurrently to the repository. Once completed, a git+ process deleted the .LOCK file and allow other writes.

[0] https://news.ycombinator.com/item?id=26491271

[1] https://news.ycombinator.com/item?id=26491428


  👤 metaloha Accepted Answer ✓
Git is already fundamentally serverless, isn't it? Sites like GitHub and GitLab (and whatever a company might have set up locally) are conveniences so that developers don't need to keep track of each other's keys and branches to multiple origins when multiple devs are working on the same branch. An origin can be any machine that is accessible to yours that is also running Git.