mislav / hub

A command-line tool that makes git easier to use with GitHub.
https://hub.github.com/
MIT License
22.82k stars 2.2k forks source link

Enable github pages `/docs` folder in master branch #2302

Closed lamyergeier closed 5 years ago

lamyergeier commented 5 years ago

Is it possible to enable github pages, if /docs folder in master branch is present, from commandline?

mislav commented 5 years ago

Yes. To enable a pages site from /docs in master:

echo '{"source":{"path":"/docs","branch":"master"}}' | \
  hub api -H 'accept: application/vnd.github.switcheroo-preview+json' \
    repos/{owner}/{repo}/pages --input -

Do disable them:

hub api -H 'accept: application/vnd.github.switcheroo-preview+json' -XDELETE \
  repos/{owner}/{repo}/pages

The placeholders {owner} and {repo} will be substituted with information about the current repo, if you're in its folder. Or, you can supply your own values explicitly.