5

GitHub Help shows the following options for GitHub Pages:

  • gh-pages branch
  • master branch
  • master branch /docs folder

Then can we use a branch whose name is not master or gh-pages? For example, is there any way to select a "site" branch for GitHub Pages? I tried to select the site branch in Settings, but did not see such option. So can we only use master or gh-pages? Is this documented somewhere?

# I want to know this because I'm using the branch name in my site content and want to know if I need to escape the name.

nekketsuuu
  • 1,641
  • 1
  • 21
  • 26

1 Answers1

3

Update Sept. 2020: yes actually.

"Build and deploy GitHub Pages from any branch"

Repositories that use GitHub Pages can now build and deploy from any branch.
Publishing to the special gh-pages branch will still work the same as it always has, but you can now choose a different branch in your repository as the publishing source.
This functionality also removes the hardcoded dependency on user and organization pages having a master branch.


Original answer:

No, those are the tow official publication sources in term of branches.

The docs folder could be a submodule which then might be:

  • the same repository
  • any branch you want

That way, publishing your pages from docs/ could allow you to publish from any branch content.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250