Skip to content

Instantly share code, notes, and snippets.

@bronzehedwick
Created March 15, 2018 02:57
Show Gist options
  • Save bronzehedwick/09269494cfea444f212887fde2bf7eff to your computer and use it in GitHub Desktop.
Save bronzehedwick/09269494cfea444f212887fde2bf7eff to your computer and use it in GitHub Desktop.
Git post receive hook to deploy a hugo site
#!/bin/sh
GIT_DIR=/path/to/hugo/source
WEB_DIR=/path/to/webroot
# pull the latest code.
git --git-dir "$GIT_DIR/.git" --work-tree "$GIT_DIR" pull origin master
git --git-dir "$GIT_DIR/.git" --work-tree "$GIT_DIR" checkout --force
# build the site.
hugo --source "$GIT_DIR" --destination "$WEB_DIR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment