Here is how I deploy it:
It clones your existing repository from the current directory to a temporary one (guessing the URL of the repo from
jekyll buildin that temporary directory, which saves the output in another temporary directory.
gh-pagesbranch or creates one if it doesn't exist.
Copies the content of the site built by
jekyll buildinto the branch, thus overwriting existing files, commits and pushes to GitHub.
Cleans up all temporary directories.
Using this gem is very easy. Just install it with
gem install jgd and then run in the root directory of your Jekyll blog.
You can easily integrate
jgd with Travis. See
.travis.yml of this blog.
Full documentation about the gem is located here.