A single GitHub Pages repository can host many games, each in its own subfolder. Each folder with an index.html becomes its own URL path.

๐Ÿ“ Repository Structure

Using your example repo โ€” github.com/softhints/games:

games/
โ”œโ”€โ”€ index.html          โ† optional landing page with links to games
โ”œโ”€โ”€ tetridle/
โ”‚   โ””โ”€โ”€ index.html      โ† Tetris game
โ””โ”€โ”€ chess/
    โ””โ”€โ”€ index.html      โ† Chess game

๐Ÿ”— How URLs Map to Folders

File in repo Live URL
index.html https://softhints.github.io/games/
tetridle/index.html https://softhints.github.io/games/tetridle/
chess/index.html https://softhints.github.io/games/chess/

Key rule: every game's file must be named exactly index.html inside its own folder. GitHub Pages serves the index.html of any folder automatically.

๐Ÿš€ Setup (One-Time)

  1. Create a public repo on GitHub (e.g. games).
  2. Add folders + files โ€” for each game, create a folder and upload its main file renamed to index.html. You can drag-and-drop directly on GitHub's web UI ("Add file โ†’ Upload files").
  3. Commit the changes.
  4. Enable Pages:
    • Repo โ†’ Settings โ†’ Pages (left sidebar)
    • Source: Deploy from a branch
    • Branch: main ยท Folder: / (root)
    • Click Save
  5. Wait ~1 minute โ€” the live URL appears at the top of the Pages settings page.

โž• Adding a New Game Later

  1. Create a new folder (e.g. snake/).
  2. Upload your game file as snake/index.html.
  3. Commit โ€” the game is instantly live at
    https://softhints.github.io/games/snake/

No need to touch Pages settings again.

โœ๏ธ Updating an Existing Game

Just re-upload the file (replacing the old index.html in that folder) and commit. Pages rebuilds automatically within a minute or two.

๐Ÿ  Optional: Landing Page

A simple root index.html to link to all games:

<!DOCTYPE html>
<html>
<head><title>Games</title></head>
<body style="font-family:sans-serif;padding:40px;background:#1a1c21;color:#e9e2d7">
  <h1>๐ŸŽฎ Games</h1>
  <ul style="line-height:2;font-size:18px">
    <li><a href="./tetridle/" style="color:#ffc454">Tetridle</a></li>
    <li><a href="./chess/" style="color:#ffc454">Chess</a></li>
  </ul>
</body>
</html>

๐Ÿ’ก Pro Tip โ€” Cleaner URL

Name the repo exactly your-username.github.io (e.g. softhints.github.io). Then games live at:

  • https://your-username.github.io/tetridle/
  • https://your-username.github.io/chess/

โš ๏ธ Common Gotchas

Issue Fix
404 on a game File must be named index.html (lowercase), not Index.html or tetris.html
Repo must be Public Private repos need GitHub Pro for Pages
Change not showing Hard-refresh (Ctrl/Cmd+Shift+R) โ€” Pages caches aggressively
Case sensitivity URLs are case-sensitive: /Chess/ โ‰  /chess/
Root shows 404 Either add a root index.html, or just visit a subfolder directly

โœ… Your Live Games

That's it โ€” one repo, unlimited games, zero hosting cost. ๐ŸŽ‰