In this video, you put a stand-in copy of Alex’s packing list online with GitHub Pages, checked the live site in DevTools, and published a fix. Publishing is optional. To do it, you need a free GitHub account with a verified email address, and the repository must be public.
Key Points
- GitHub Pages serves your folder’s files the way Live Preview does, but on the internet, at an address anyone can open. Unlike Live Preview, it changes only when you upload.
- Create a repository: on GitHub, create a new repository named
packing-list, like your folder. Make it Public and turn on Add README, so the repository doesn’t start empty. - Upload the files, not the folder: open Add file and choose Upload files. From your
packing-listfolder, select everything inside and drag those files onto the page. When an address ends at a folder, the server sends that folder’sindex.html, soindex.htmlmust sit at the top of the repository. Then commit the upload, which saves it in the repository. - Turn on Pages: in the repository’s Settings tab, open Pages in the sidebar. Under Source, choose Deploy from a branch. Pick the
mainbranch, where your upload went, and the/ (root)folder, the top of the repository. Then click Save. - Wait for the green check: GitHub publishes your files as they are. The Actions tab shows a run called pages build and deployment, with a yellow dot while it works. It often takes about a minute, sometimes several. Then the dot turns into a green check. A failed deploy shows a red cross there instead.
- The address: back in Settings ▸ Pages, you’ll find your site’s address and a Visit site button. The address is your username, then
github.io, then the repository’s name, such ashttps://alex.github.io/packing-list/. - Check the live site: with DevTools open, the Console should show no errors. To see every file arrive, open the Network panel and reload the page. Each file gets a row (the page itself, then the stylesheet and all the modules), and every file loads:
200, or304for the page itself, which means the browser’s copy is still current. - A
404names a file the server couldn’t find. Fix its path or the case of its name, upload it again, and hard-reload after the next green check (see Watch out below). - Publish a change: fix the file and check it in Live Preview, then upload it the same way. A file with the same name replaces the old one. Committing starts a new run in the Actions tab. Wait for its green check.
- Watch out: a plain reload can still show the old page for up to ten minutes, because Pages tells browsers they may reuse its files for that long. After a green check, an old page is most likely a cached copy, not a failed deploy. Hard-reload with Ctrl+Shift+R, or Cmd+Shift+R on a Mac, to fetch every file again.
- Still the old page? If a hard reload still shows the old page, check that the uploaded file in the repository has your fix, and that the address you opened is your Pages address.
The Steps
Once: