Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Deploy Jekyll on VPS using git-hook

Install dependencies

$ apt-get install git nginx # or using any other package manager and web server

Create directories and repositories:

cd $HOME
mkdir -p blog blog.git tmp
cd blog.git
git --bare init

Create git hook

file $HOME/blog.git/hooks/post-receive

GIT_REPO=$HOME/blog.git
TMP_GIT_CLONE=$HOME/tmp/blog
PUBLIC_WWW=$HOME/blog

git clone $GIT_REPO $TMP_GIT_CLONE
jekyll --no-auto $TMP_GIT_CLONE $PUBLIC_WWW
rm -Rf $TMP_GIT_CLONE
exit

and chmod +x $HOME/blog.git/hooks/post-receive

Configure webserver

Point your webserver's document root to $HOME/blog and reload it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.