Search code examples
github-apioctokit

How do I use Octokit to turn on Github Pages for a repo?


I have a Ruby program that makes a new repo for a user using Octokit. I would also like to enable Github Pages for the repo from my program, but I can't figure out if that is possible. The Pages API seems to assume pages are already enabled.


Solution

  • There is no specific API to call when "enabling" the GitHub page feature.
    As described in "Configuring a publishing source for GitHub Pages"

    If your site is a User or Organization Page that has a repository named <username>.github.io or <orgname>.github.io, you cannot publish your site's source files from different locations.
    User and Organization Pages that have this type of repository name are only published from the master branch.

    For other project repos, the following settings needs to be set manually first:

    https://help.github.com/assets/images/help/pages/none-source-setting.png