If you have a git repository on a server with ssh access, you can just clone it:
# This works. git clonessh://username@hostname/path/to/repo
Once you've done some work, you can push your changes back to the origin server. By default, git won't let you push to the branch that is currently checked out, but this is easy to change:
# Run this on the remote server. git configreceive.denyCurrentBranch updateInstead
This is a nice way to work on server-side files without SSH lag or error-prone copying. If you need more then just a file server, git can run a shell script when it receives a new push:
cat >.git/hooks/post-update <<EOF#!/bin/sh set -euo pipefail cd /path/to/site /path/to/generator EOFchmod a+x.git/hooks/post-update
You'll even get the script's output sent back to your computer's terminal. . I've have git set up to this blog's site generator: It's very nice to be able to type up posts locally, and then push them to the server.
It's also backed up by default: If the server breaks, I've still got the copy on my laptop, and if my laptop breaks, I can download everything from the server.