Skip to main content
GitHub Pages lets you publish a static website directly from a GitHub repository without needing separate hosting. If your repo contains standard web assets such as index.html, style.css, and script.js, GitHub Pages can serve them so visitors can open a URL and run your site or web app in any browser. In this repository, index.html, style.css, and script.js combine to make the Block Buster game playable in the browser without downloading files.
The image shows a GitHub repository page for a project called "block-buster," which is an enhanced version of the Block Buster Brick Breaker game. The project includes several files such as .gitignore, README.md, index.html, script.js, and style.css.

How to enable GitHub Pages for your repository

Follow these steps to publish the repository as a static site:
  1. Open the repository on GitHub and select Settings.
  2. In the left sidebar, choose Pages under the “Code and automation” section.
  3. Under Build and deployment, choose a source for your site:
    • Deploy from a branch — quick and simple for static project pages.
    • Use GitHub Actions — useful when you need a build pipeline (for example, bundling, minification, or static site generators).
  4. If you choose Deploy from a branch, select the branch (e.g., main) and pick the folder to publish:
    • Root (/) — use when index.html is in the repository root.
    • /docs — use if you maintain site files inside a docs directory.
  5. Save your settings. GitHub Pages will start building the site; this can take a few minutes.
The image shows the GitHub Pages settings interface, where options for build and deployment using branches or GitHub Actions are available. It includes sections for access, code automation, and security features related to a GitHub repository.

Quick reference: source options

Accessing your published site

After a successful build, GitHub Pages supplies the public URL for your site. For project pages the URL format is:
Example:
Copy the provided URL from the Pages settings and open it in a browser tab. If the build is still running, wait a few minutes and refresh the page. If you see a 404, double-check that index.html is in the selected publish folder (/ or /docs) and that the build completed successfully.
Ensure index.html exists in the folder you selected to publish (root or docs). Without a valid index.html, GitHub Pages has no default file to serve and the site will return a 404.
A few minutes after enabling Pages and once the build finishes, the Block Buster game in this repo is served publicly and can be played directly from the GitHub Pages URL.
The image shows the start screen of a web-based game called "Block Buster," featuring options to start the game or reset the score, with various game attributes like dynamic brick breaker and power-ups listed.
Anyone with the URL can open and play the game in their browser.
The image shows a browser-based game called "Block Buster," which includes colorful blocks and a ball that the player controls to break them. The game interface displays scores, lives, bricks, and balls, along with options to pause or exit the game.

Additional configuration and troubleshooting

  • Custom domain: Configure a custom domain from the Pages settings if you own a domain. GitHub provides DNS instructions and will create a CNAME file for you.
  • Themes: For content sites, you can apply a theme (Jekyll themes are available) via the repository settings or a static site generator.
  • Common issues:
    • 404 after build: Verify index.html location and successful build logs.
    • Changes not visible: Clear browser cache or force-refresh (Ctrl/⌘+Shift+R).
    • HTTPS not enabled: Pages provides HTTPS by default; verify the certificate is active in Pages settings.

Watch Video

Practice Lab