3. it only had to handle three commands in the line-based protocol. I've changed the function names from git-remote-bsv below, for clarity. The processes are meant to be run on the remote server, so it's backward. "capabilities\n" -> "connect\n\n" "connect git-upload-pack\n" -> remote_uploads_to_us() "connect git-receive-pack\n" -> remote_receives_from_us() "connect" expects a process to be launched on the remote, with stdin/stdout piped. 4. for both commands, first I synced the shadow dir called "mirror_dir" down from the remote. this ensured it was a canonical copy. I downloaded these files and dirs: /description /config /info /refs /HEAD /packed-refs I additionally downloaded /objects, but I made sure not to overwrite files that were newer locally, and if there were multiple copies on the chain, I made sure to always pick the oldest one, to retain integrity if a private key were compromised. In case the repository had not refs remotely, or wasn't present remotely, I then instantiated a refs folder: 140 fse.ensureDirSync(mirror_path + '/refs')