Skip to main content

Описание GitHub Pages

Вы можете использовать GitHub Pages для размещения веб-сайта о себе, организации или проекте непосредственно из репозитория на GitHub.

Кто может использовать эту функцию?

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 your GitHub Enterprise Server instance.

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 your GitHub Enterprise Server instance.

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

Warning: If your site administrator has enabled Public Pages, GitHub Pages sites are publicly available on the internet, even if the repository for the site is private or internal. If you have sensitive data in your site's repository, you may want to remove the data before publishing. For more information, see "Configuring GitHub Pages for your enterprise" and "About repositories."

You can publish your site when changes are pushed to a specific branch, or you can write a GitHub Actions workflow to publish your site. To use GitHub Actions as a publishing source for GitHub Pages, a site administrator must enable GitHub Actions for GitHub Enterprise Server. For more information, see "Enabling GitHub Actions for GitHub Enterprise Server."

If you do not need any control over the build process for your site, we recommend that you publish your site when changes are pushed to a specific branch. You can specify which branch and folder to use as your publishing source. The source branch can be any branch in your repository, and the source folder can either be the root of the repository (/) on the source branch or a /docs folder on the source branch. Whenever changes are pushed to the source branch, the changes in the source folder will be published to your GitHub Pages site.

If you want to use a build process other than Jekyll or you do not want a dedicated branch to hold your compiled static files, we recommend that you write a GitHub Actions workflow to publish your site. GitHub Enterprise Server provides workflow templates for common publishing scenarios to help you write your workflow.

For more information, see "Configuring a publishing source for your GitHub Pages site."

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.

If you use a custom build process or a static site generator other than Jekyll, you can write a GitHub Actions to build and publish your site. GitHub Enterprise Server provides workflow templates for several static site generators. For more information, see "Configuring a publishing source for your GitHub Pages site."

If you publish your site from a source branch, GitHub Pages will use Jekyll to build your site by default. If you want to use a static site generator other than Jekyll, we recommend that you write a GitHub Actions to build and publish your site instead. Otherwise, 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 sites shouldn't be used for sensitive transactions like sending passwords or credit card numbers.

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.

Educational exercises

Using GitHub Pages to create a copy of an existing website as a learning exercise is not prohibited. However, in addition to complying with the GitHub Terms of Service, you must write the code yourself, the site must not collect any user data, and you must include a prominent disclaimer on the site indicating that the project is not associated with the original and was only created for educational purposes.

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.
  • GitHub Pages deployments will timeout if they take longer than 10 minutes.

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