Automated Deployment

There are a number of ways to easily automate the deployment of a Jekyll site.

Continuous Integration Service

One of the easiest ways to set up an automated deployment flow is by using a CI.

These services run a script when there’s a commit on your Git repository. You might want this script to build the site, run tests over the output then deploy it to the service of your choice.

We have guides for the following providers:

Git post-receive hook

To have a remote server handle the deploy for you every time you push changes using Git, you can create a user account which has all the public keys that are authorized to deploy in its authorized_keys file. With that in place, setting up the post-receive hook is done as follows:

laptop$ ssh
server$ mkdir myrepo.git
server$ cd myrepo.git
server$ git --bare init
server$ cp hooks/post-receive.sample hooks/post-receive
server$ mkdir /var/www/myrepo

Next, add the following lines to hooks/post-receive and be sure Jekyll is installed on the server:


BUNDLE_GEMFILE=$GEMFILE bundle exec jekyll build -s $TMP_GIT_CLONE -d $PUBLIC_WWW

Finally, run the following command on any users laptop that needs to be able to deploy using this hook:

laptops$ git remote add deploy

Deploying is now as easy as telling nginx or Apache to look at /var/www/myrepo and running the following:

laptops$ git push deploy master