This also fixes a bug in gh-update-pages: gh-update-pages does not handle file deletition, meaning that stale files are never removed.
The git-update-ghpages script comes from https://github.com/rstacruz/git-update-ghpages. It is modified to fix syntax errors, as reported in this issue, and prevent failures when there's nothing to commit.