Publish Documentation to GitHub Pages

The github_pages_rake_tasks gem creates a rake task that pushes files from a local documentation directory to a remote Git repository branch.

By default, the rake task github-pages:publish is created which pushes the doc directory within the local copy of a repository to the same repository's gh-pages branch. The contents of the branch are completely replaced by the contents of the documentation directory.

This task is useful for publishing rdoc or yard documentation using GitHub Pages.


Add this line to your application's Gemfile:

gem 'github_pages_rake_tasks'

And then execute:

$ bundle

Or install it directly with the gem command line:

$ gem install github_pages_rake_tasks


Add the github-pages:publish task to Rake by adding the following lines in your Rakefile:

require 'github_pages_rake_tasks'

You can also configure the task by providing a block during initialization:

require 'github_pages_rake_tasks' do |task|
  task.doc_dir = 'documentation'
  task.repo_url = ''
  task.branch_name = 'master'

See the full usage documentation for more details.


After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to


Bug reports and pull requests are welcome on GitHub at

Copyright and License

Copyright © 2019 James Couball. Free use of this software is granted under the terms of the MIT License. See LICENSE for details.