Skip to main content

此版本的 GitHub Enterprise 已停止服务 2022-06-03. 即使针对重大安全问题,也不会发布补丁。 要获得更好的性能、改进的安全性和新功能,请升级到 GitHub Enterprise 的最新版本。 如需升级方面的帮助,请联系 GitHub Enterprise 支持

About GitHub Pages

You can use GitHub Pages to host a website about yourself, your organization, or your project directly from a repository on 您的 GitHub Enterprise Server 实例.

GitHub Pages 适用于具有 GitHub Free 和组织的 GitHub Free 的公共仓库,以及具有 GitHub Pro、GitHub Team、GitHub Enterprise Cloud 和 GitHub Enterprise Server 的公共和私有仓库。

About GitHub Pages

GitHub Pages is a static site hosting service that takes HTML, CSS, and JavaScript files straight from a repository on GitHub Enterprise Server, optionally runs the files through a build process, and publishes a website. You can see examples of GitHub Pages sites in the GitHub Pages examples collection.

To get started, see "Creating a GitHub Pages site."

Organization owners can disable the publication of GitHub Pages sites from the organization's repositories. For more information, see "Managing the publication of GitHub Pages sites for your organization."

Types of GitHub Pages sites

There are three types of GitHub Pages sites: project, user, and organization. Project sites are connected to a specific project hosted on GitHub Enterprise Server, such as a JavaScript library or a recipe collection. User and organization sites are connected to a specific account on 您的 GitHub Enterprise Server 实例.

To publish a user site, you must create a repository owned by your personal account that's named <username>.<hostname>. To publish an organization site, you must create a repository owned by an organization that's named <organization>.<hostname>.

The source files for a project site are stored in the same repository as their project.

You can only create one user or organization site for each account on GitHub Enterprise Server. Project sites, whether owned by an organization or a personal account, are unlimited.

The URL where your site is available depends on whether subdomain isolation is enabled for 您的 GitHub Enterprise Server 实例.

Type of siteSubdomain isolation enabledSubdomain isolation disabled
Userhttp(s)://pages.<hostname>/<username>http(s)://<hostname>/pages/<username>
Organizationhttp(s)://pages.<hostname>/<organization>http(s)://<hostname>/pages/<organization>
Project site owned by personal accounthttp(s)://pages.<hostname>/<username>/<repository>/http(s)://<hostname>/pages/<username>/<repository>/
Project site owned by organization accounthttp(s)://pages.<hostname>/<orgname>/<repository>/http(s)://<hostname>/pages/<orgname>/<repository>/

For more information, see "Enabling subdomain isolation" or contact your site administrator.

Publishing sources for GitHub Pages sites

The publishing source for your GitHub Pages site is the branch and folder where the source files for your site are stored.

警告:如果您的站点管理员启用了公共页面, 则 GitHub Pages 站点在互联网上公开可用,即使站点的存储库是私有的或内部的。 如果站点的仓库中有敏感数据,您可能想要在发布前� 除它。 更多信息请参阅“为企业配置 GitHub Pages”和“关于存储库”。

If the default publishing source exists in your repository, GitHub Pages will automatically publish a site from that source. The default publishing source for user and organization sites is the root of the default branch for the repository. The default publishing source for project sites is the root of the gh-pages branch.

If you want to keep the source files for your site in a different location, you can change the publishing source for your site. You can publish your site from any branch in the repository, either from the root of the repository on that branch, /, or from the /docs folder on that branch. For more information, see "Configuring a publishing source for your GitHub Pages site."

If you choose the /docs folder of any branch as your publishing source, GitHub Pages will read everything to publish your site from the /docs folder.

Static site generators

GitHub Pages publishes any static files that you push to your repository. You can create your own static files or use a static site generator to build your site for you. You can also customize your own build process locally or on another server. We recommend Jekyll, a static site generator with built-in support for GitHub Pages and a simplified build process. For more information, see "About GitHub Pages and Jekyll."

GitHub Pages will use Jekyll to build your site by default. If you want to use a static site generator other than Jekyll, disable the Jekyll build process by creating an empty file called .nojekyll in the root of your publishing source, then follow your static site generator's instructions to build your site locally.

GitHub Pages does not support server-side languages such as PHP, Ruby, or Python.

Limits on use of GitHub Pages

GitHub Pages is not intended for or allowed to be used as a free web-hosting service to run your online business, e-commerce site, or any other website that is primarily directed at either facilitating commercial transactions or providing commercial software as a service (SaaS). GitHub Pages 站点不应该用于敏感事务,例如发送密� �或信用卡号� �。

In addition, your use of GitHub Pages is subject to the GitHub Terms of Service, including the restrictions on get-rich-quick schemes, sexually obscene content, and violent or threatening content or activity.

Usage limits

GitHub Pages sites are subject to the following usage limits:

  • GitHub Pages source repositories have a recommended limit of 1 GB.
  • Published GitHub Pages sites may be no larger than 1 GB.

MIME types on GitHub Pages

A MIME type is a header that a server sends to a browser, providing information about the nature and format of the files the browser requested. GitHub Pages supports more than 750 MIME types across thousands of file extensions. The list of supported MIME types is generated from the mime-db project.

While you can't specify custom MIME types on a per-file or per-repository basis, you can add or modify MIME types for use on GitHub Pages. For more information, see the mime-db contributing guidelines.

Further reading