GitHub Pages
Publish a versioned release from a tag and understand when Pages is a static site host rather than a substitute for Git.
Tag, Release, and Pages are three jobs
Git Tags named a verified commit. This lesson uses that name on GitHub. A GitHub Release is a GitHub page (notes, optional files) around a tag. GitHub Pages is a static-site host on the same GitHub Repository. Neither is a Git command. There is no git pages and no git release.
Tag
A ref in the object database. git tag -a v1.4.0 already created it. git push origin v1.4.0 publishes that name.
Release and Pages
A Release wraps the tag with notes. Pages copies committed HTML to https://OWNER.github.io/REPO/. GitHub created both features.
Commit a tiny static site first
Pages serves files that already exist as Git snapshots. Put a small site on a repository you own—the disposable remote from GitHub Repository is enough. A docs/ folder on the default branch keeps the lab off the project root.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Practice Pages</title>
</head>
<body>
<h1>Practice Pages</h1>
<p>This file is hosted by GitHub Pages. Git still stores the commit.</p>
</body>
</html>
Commit docs/index.html (and optionally an empty docs/.nojekyll so GitHub does not run Jekyll). Push the branch. GitHub Issues can track a later content bug; they do not publish the site.
Push the Git tag, then wrap it
# Tag already exists locally from Git Tags. Publish that name, then wrap it on GitHub.
git push origin v1.4.0
git ls-remote --tags origin refs/tags/v1.4.0
gh release create v1.4.0 --title "v1.4.0" --notes "Practice snapshot of the static site."
gh release view v1.4.0Create the annotated tag on the commit that contains the site, the way Git Tags taught. A normal git push origin main does not publish every local tag. Push v1.4.0 explicitly, then confirm with git ls-remote --tags origin.
Test what you learned
Type the command that publishes the local tag v1.4.0 to origin.
Create the GitHub Release
gh release create v1.4.0 asks GitHub to open a Release for that tag. The website Releases → Draft a new release is the same object. The tag must already exist on GitHub (or gh can create it from a local tag you specify). Notes describe the snapshot; they are not a commit message and they do not appear in git log.
Test what you learned
Type the GitHub CLI command that creates a release for tag v1.4.0 (title and notes flags come after).
gh release view v1.4.0 prints the GitHub notes so you can check the URL. Attaching binaries is optional for this lab. Do not upload tokens or private keys as release assets.
Test what you learned
Type the GitHub CLI command that shows the GitHub Release for tag v1.4.0.
Enable Pages as a static host
# After docs/index.html is on the default branch of a repository YOU own:
# GitHub → Settings → Pages → Deploy from a branch → main → /docs
# Wait for the green check, then open:
# https://OWNER.github.io/REPO/
# Optional: stop GitHub from running Jekyll on a plain HTML folder
# (commit an empty .nojekyll next to index.html)Settings → Pages → Deploy from a branch. Choose the default branch and the /docs folder. Wait until GitHub reports the site is live, then open the github.io URL. Source is still Git: change a heading, commit, push, and refresh. Custom domains and GitHub Actions builds are later topics; this workshop stops at branch-based static files.
Pages is not a substitute for Git
# None of these replace git commit or git tag.
# Pages copies files to a static host. A Release is a GitHub page around a tag.
# git log still will not show "the website."The clone URL is Git. The Pages URL is a website. git clone of the Pages URL is the wrong habit: you would be cloning HTML output in the best case, and nothing useful in the usual case. History, tags, and remotes stay in the Git repository. Pages can go stale, 404, or show an old commit while git log has moved on—fetch and look at the branch you actually deployed.
Guided practice: tag, release, site
- 01Commit the static page
On a repository you own, add
docs/index.html. Push the default branch. Confirmgit remote -vis your GitHub URL. - 02Tag the site commit
Annotated tag
v1.4.0(or another unused version) at that commit.git push origin v1.4.0. - 03Create the Release
gh release createwith a one-paragraph note. Open the Releases tab and confirm it points at the tag. - 04Enable Pages
Deploy from the default branch, folder
/docs. Open thegithub.ioURL and read your heading. - 05Refuse the wrong model
Write one sentence: which URL is Git, which is the website, and why you will not move
v1.4.0if you later fix a typo.
Independent lab: release and Pages report
- On a GitHub repository you own, commit a tiny static page and push it.
- Create an annotated tag at that commit,
git push originthat tag, andgh release createfor it. - Enable GitHub Pages from a branch (root or
/docs) and open the live site. - Write four lines: tag name, Release URL, Pages URL, and which of those three is a Git object rather than a GitHub page.
- Do not move the published tag, do not enable Pages on a project you do not maintain, and do not open a pull request.
Common Pages and Release mistakes
Calling Pages a Git command
Pages is GitHub hosting. Commits and tags remain Git.
Treating a Release as git tag
The Release is notes on GitHub. The tag is the Git name. Create the tag first.
Moving v1.4.0 after the site is live
That breaks anyone who already fetched the name. Commit a fix and tag v1.4.1.
Enabling Pages on someone else’s repo
Practice on the disposable remote. Upstream of a fork is not your lab.
Lesson review
You can publish a GitHub Release from a Git tag and host a static site with GitHub Pages without confusing the website for Git. The next lesson is the unit project: sync two clones through the hosted remote.
- I know a Git tag is Git, while a GitHub Release and GitHub Pages are GitHub features.
- I can
git push origin v1.4.0,gh release create, and enable Pages from a branch. - I treat Pages as a static host, not a substitute for commits or tags.
- I do not move a published version tag, and I practice on a repository I own.