Search code examples
node.jsgitservercloudinfrastructure

How to serve bare git repos from a static server?


I'm using NodeJS-Git-Server which essentially allows clients to connect to my server and clone bare git repositories on disk. NodeJSGitServer creates a connection with the client's git process to establish what packets are missing from their machine, and then the server streams them to the client. This is standard git protocol.

NodeJSGitServer spawns child processes that run git-upload-pack and git-receive-pack, which then pipe the packs to the client's response.

These git commands take an argument of the path to the local git repository, however. So it seems like I'd need to host all my bare git repositories on the same server running these git commands to communicate with clients. Is there any way to host these bare git repos on a separate server from my node server, like an S3 bucket. I plan on using Heroku and their storage is ephemeral and limited.


Solution

    • The nodejs server appears to handle only repos accessible on local paths,

    • AFAIK, git-upload-pack and git-receive-pack are intended to be run on the system where the repositories are hosted


    You may try to mount the remote repos locally -- using nfs or sshfs for example. Do test performances though.