Put your game on GitHub Pages (a public repository)
For people who already use GitHub. Your game at your-name.github.io, from a repository that only ever holds the built game, which anyone can browse on a free plan. New to this? Use Netlify Drop or itch.io.
Levels: Novice, Moderate, Advanced. Last checked: not yet on the live site (due Oct 14–16).
Course buyers: this guide is also lesson 8.4 Self-host on GitHub Pages.
The privacy trap. Read this first. On a free GitHub account, Pages only works from a public repository, and a public repository shows every file you ever put in it, forever, in its history. If you upload your project folder, your original photos are public, even if you delete them later. Only ever put the built game (the unzipped export) in the repository you publish from.
Even the build-only repository is public. The built game contains the photos it uses (cleaned of
location data), and on a free plan anyone can browse that repository: it shows on your GitHub profile
and can turn up in GitHub search, and the noindex tag only covers the game page, not the repository.
So on GitHub Pages your photos are easier to find than on Netlify Drop or itch.io. Only use it if
that's fine for these photos; Pages from a private repository (a paid plan) hides the files, though
the published site stays public.
What you'll get: (Moderate and Advanced) your game on GitHub Pages at
https://[your-name].github.io/[repo]/, from a repository that never holds your original photos or
project files.
Before you start: your packaged game (in the Pixelora editor, Export → Package my game
saves a zip in your project's export/ folder) and a GitHub account.
Noviceevery step, one path
Use Netlify Drop or itch.io instead
GitHub Pages is easy to get wrong in a way that publishes your photos. You don't need it: Netlify Drop or itch.io (with a password) do the same job safely in a few minutes.
If you already put your project on GitHub
If your project folder is in a public GitHub repository: delete the repository (repository → Settings → Delete this repository). Deleting the files isn't enough; the history keeps them. Anyone who already forked or cloned a public repository keeps their copy. Then use Netlify Drop.
Moderatemore control
One repo, only the build.
- Create a new, empty repository just for the game (never your project folder, never a repo that
has ever held
photos/). Name it something unguessable, likebiscuit-a7k3q9. - Unzip the export. On the repo page, Add file → Upload files, drag in everything that is
inside the unzipped folder (
index.htmlmust be at the top of the repo), and commit. GitHub takes up to 100 files per upload (upload in batches if you have more) and up to 25 MB per file in the browser (100 MB from the command line). A bigger song or video won't upload: make it smaller (MP3 at 128 kbps is plenty), package again, or use Netlify Drop instead. - Add file → Create new file, name it
.nojekyll(with the dot), leave it empty and commit. It stops GitHub from dropping game files whose names start with_. - Settings → Pages → Build and deployment → Source: Deploy from a branch →
branch
main, folder/ (root)→ Save. - After a minute, the page shows your address.
Private repositories. Pages from a private repository needs a paid GitHub plan; the published site is still public either way. Check GitHub's current plans before you rely on it.
Update the game. Uploading the new files over the old ones leaves any photo you removed online and in the repository's history. Instead: delete the repository (Settings → Delete this repository), create it again with the same name, upload the new unzipped export and turn Pages on again (steps 2 to 4). Same link, and nothing old left in the repository (copies others already forked or cloned stay).
Advanceddo it yourself
Publish the export from the command line. Keep your project repository private (or off GitHub),
and push only the cleaned export to the build-only repository from the Moderate steps. Building in
GitHub Actions from the project repository doesn't work here: with photos/ left out of it (as it
should be), the build has no photos to put in the game.
site=$(mktemp -d)
unzip -q export/[your-game]-build.zip -d "$site"
touch "$site/.nojekyll"
(cd "$site" && git init -q -b main && git add -A && git commit -qm "Publish game" \
&& git push --force git@github.com:[your-name]/[repo].git main)Run it from the project folder. The export is unzipped into a temporary folder outside the project,
so nothing lands next to your project files; check that folder holds only the unzipped export before
you push. --force replaces the branch's history with this one commit each time. GitHub can keep an
old commit reachable for a while after a force push, so if you removed a photo, delete the repository
and create it again with the same name before you push (same link). .nojekyll stops GitHub from dropping files whose names start with _.
If the project itself is in Git, keep photos/, export/ and any flutter-web/ copy out of it:
add those lines to the project's .gitignore. They hold your photos (cleaned, but still photos).
Pages settings as in the Moderate steps (Deploy from a branch, main, / (root)).
Sub-paths. The exported build uses relative paths, so /[repo]/ works without changes (a Flutter web
copy is the exception: build it with --base-href /[repo]/, see Flutter web).
A 404 on assets means the files aren't at the root of the published folder.
Custom domain. Settings → Pages → Custom domain serves the site on a domain you own.
How to take it down
Delete the repository: repository → Settings → Delete this repository. That removes the site, the files and their history. Unpublishing the site under Settings → Pages is not enough on its own: the public repository still holds every photo. Anyone who already forked or cloned a public repository keeps their copy.
Before you share
Do these four checks before you send the link to anyone:
- Open the link in a private window (or incognito). The start screen appears and the game plays. If you set a password, it asks for it first. (Installed an app instead? Open it once with the phone in airplane mode.)
- Test it on a phone, and if you can, on the kind of phone the person you made it for has.
- Make sure the game page isn't listed in search (web links only; an installed app isn't
online). A few days after publishing, search the web for your game's address: the game page
shouldn't show up. It asks search engines not to list it (a
noindextag), but check anyway. This covers only the game page: on GitHub Pages, the public repository behind it can still be found on GitHub (see that guide's warning). - Know how to take it down. Read the "How to take it down" steps above and find the button before you need it.
Only share the link with people you trust, and only with photos of people who are happy to be in the game. Anyone who has the link (and the password, if there is one) can see the photos in it.