Couldn't find anything in the github documentation and also here on SO. But I was wondering if there could be a http://foo.github.com
for a private repository named foo
which is accessible only one had access to the foo
repository itself.
I remember having read something about github pages always being public but can't seem to find that anymore.
And surprisingly, I can't seem to find anyone else asking the question either.
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 simple workaround
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.
An actual Auth Wrapper for Jekyll (GitHub pages)
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.
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:
Securing Site That Runs on Github Pages With JSON Backend In Private Repository
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.
As outlined above, Github pages do not support that functionality. I had the same issue when our team decided to host project documentation (static HTML) internally and privately.
I ended up creating a service https://www.privatehub.cloud It is basically a simple proxy server with Github OAuth authentication, so it merely returns your GitHub repository content with a proper MIME type. By design, only who have access to foo
will be able to see foo
content at https://bar-foo.privatehub.cloud
. From functional point of view, you can think about it as a simplified GitHub pages with built-in authentication.
Unfortunately, Github OAuth does not allow to request read-only
access to private repos, so the server needs the full access (obviously, it does not write anything to your repo). As GitHub API allows to retrieve files under 1 Mb only, the service cannot return larger files. Yet, I found the service is quite suitable for small projects for internal documentation or staging version of a website.
If you press admin on a private repo and scroll down to the part about pages, it writes that it'll be public. I'll check later if .htaccess control or similar is possible, but I don't have much hope for it.
you can use GitLab. you can define private projects and all facilities is like Github.
You could host password in a repository and then just hide the page behind hidden address, that is derived from that password. This is not a very secure way, but it is simple.
来源:https://stackoverflow.com/questions/10748082/private-pages-for-a-private-github-repo