在github文档和这里也找不到任何东西。但是我想知道是否有一个名为foo的私人存储库http://foo.github.com,只有一个人可以访问foo存储库本身。

我记得读过一些关于github页面总是公开的东西,但似乎再也找不到了。

令人惊讶的是,我似乎也找不到其他人问这个问题。


当前回答

2021年1月:GitHub企业版现在可以实现(所以:github.com还没有)。 看到的:

GitHub页面的访问控制

GitHub Pages now gives you the option to limit access, making the site visible only to users with access to the repository that published the Page. With access control, you can use GitHub Pages to publish and share internal documentation and knowledge across your enterprise. As part of this release, we are introducing the following capabilities: Repo admins can select whether GitHub Pages sites are publicly visible or limited to users who have access to the repository. Both private and internal repositories support private visibility. With an internal repository, everyone in your enterprise will be able to view the Page with the same credentials they use to login to github.com Org admins can configure the visibility options that members will be able to select for their Page. For example, you can enforce that your members can only publish content privately. 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.

其他回答

如上所述,Github页面不支持该功能。当我们的团队决定在内部和私下托管项目文档(静态HTML)时,我也遇到了同样的问题。

我最终创建了一个服务https://www.privatehub.cloud它基本上是一个简单的代理服务器与Github OAuth身份验证,所以它只是返回您的Github存储库内容与适当的MIME类型。按照设计,只有有权访问foo的人才能在https://bar-foo.privatehub.cloud上看到foo的内容。从功能的角度来看,你可以把它看作是一个简化的带有内置身份验证的GitHub页面。

不幸的是,Github OAuth不允许请求对私有回购的只读访问,因此服务器需要完全访问(显然,它不会向你的回购写入任何内容)。由于GitHub API只允许检索1mb以下的文件,该服务不能返回更大的文件。然而,我发现这项服务非常适合小型项目,比如内部文档或网站的分期版本。

许多答案都过时了(在微软收购之前/免费私人回购)。这篇文章是在宣布免费私人回购之后写的。

Github页面在个人免费私人回购中不可用,如回购设置所示:

2020年(现在最基本的计划是“团队”):

请注意

所有页面都是公开的,即使您进行了升级。升级只在私有回购上启用Pages功能,就像它启用其他功能一样。Pages功能是公开的静态虚拟主机。

这个GitHub应用程序:https://github.com/apps/priv-page允许用户为他们的私有存储库拥有私有页面。

有一篇文章介绍了如何在动态加载静态内容之前请求oAuth授权:

(archive.org)在私有存储库中使用JSON后端保护在Github页面上运行的网站(原始文章变成404)

内容应该存储在一个秘密的GitHub存储库中,查看器具有对它的读访问权。GitHub页面只存储服务的JS代码。

2021年1月:GitHub企业版现在可以实现(所以:github.com还没有)。 看到的:

GitHub页面的访问控制

GitHub Pages now gives you the option to limit access, making the site visible only to users with access to the repository that published the Page. With access control, you can use GitHub Pages to publish and share internal documentation and knowledge across your enterprise. As part of this release, we are introducing the following capabilities: Repo admins can select whether GitHub Pages sites are publicly visible or limited to users who have access to the repository. Both private and internal repositories support private visibility. With an internal repository, everyone in your enterprise will be able to view the Page with the same credentials they use to login to github.com Org admins can configure the visibility options that members will be able to select for their Page. For example, you can enforce that your members can only publish content privately. 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.