GitHub Pages is available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server.
Your private GitHub organization might not be so private. Without a third-party access policy applications are able to act on behalf of your users. This includes any scopes that the user grants permissions to the application- potentially including access to private repositories.
This feature is generally available today on GitHub Enterprise Cloud. To enable access control on Pages, navigate to your repository settings, and click the dropdown menu to toggle between public and private visibility for your site.
I had raised a support ticket against Github and got a response confirming the fact that ALL pages are public. I've now requested them to add a note to help.github.com/pages.
According to GitHub Pages documentation:
All project repositories are ready to use the generator for publishing. However, please note that private repositories will publish pages that are public.
So no, at this time there is no way to create private GitHub pages from a private GitHub repository.
EDIT:
A workaround for some situations that might be helpful is to simply rename the repo to something other than the GitHub pages format while you want it to be private (for example in a development phase) and when ready to make it public then correct the name. Obviously this still doesn't help if you are looking for a way to publish pages that have authentication, but if you just want to hide a GH pages project while it's in progress, this could help.
Alternatively, there is a project called Jekyll Auth that GitHubber @benbalter made for such use. Jekyll Auth provides a basic authentication wrapper for jekyll projects, including GitHub pages. See the repo's README for use.
Many answers are outdated (pre-Microsoft acquisition/free private repos). This one was written after the announcement of free private repos.
Github pages are not available on free private repos for individuals, as shown in the repo settings:
2020 (most basic plan is now "Team"):
All pages are public, even if you upgrade. Upgrading only enables the Pages feature on private repos, just like it enables other features. The Pages feature is publicly available static web hosting.
The page.github.com does mention:
Github Pages are hosted free and easily published through our site,
Without ever mentioning access control.
The GitHub page help doesn't mention any ACL either.
They are best managed in a gh-pages branch, and can be managed in their own submodule.
But again, without any restriction in term of visibility once published by GitHub.
There is an article with a working idea on how to request oAuth authorization before loading static content dynamically:
(archive.org) Securing Site That Runs on Github Pages With JSON Backend In Private Repository (original article that became 404)
Content should be stored in a secret GitHub repository with a viewer having read access to it. GitHub pages stores only the serving JS code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With