SovranCode
HomeCourses Git & GitHub GitHub Pages
This device
Course contentsGitHub Pages · 41 topics

1. Git Fundamentals

Git IntroductionGit Version ControlGit vs GitHubGit InstallationGit Working TreeGit RepositoryGit CommitGit .gitignoreGit Project: Learning Journal

2. Git History

Git LogGit DiffGit ResetGit RevertGit StashGit Project: Messy Repository

3. Branches & History

Git BranchGit MergeGit Merge ConflictsGit RebaseGit Cherry-PickGit TagsGit Project: Feature Branch

4. Remotes and GitHub

Git RemoteGitHub AuthenticationGitHub RepositoryGitHub ForkGitHub IssuesGitHub PagesGit Project: Two Clone Sync

5. GitHub Collaboration

GitHub Pull RequestsGitHub Code ReviewGit Branching WorkflowGitHub Branch ProtectionGitHub CollaborationGitHub ContributingGit Project: Reviewed Pull Request

6. Automation and Professional Git

GitHub ActionsGit InternalsGit RecoveryGitHub SecurityGit Project: Team Repository CIProject
Learn Git & GitHub40 complete · 1 planned

1. Git Fundamentals

Git IntroductionGit Version ControlGit vs GitHubGit InstallationGit Working TreeGit RepositoryGit CommitGit .gitignoreGit Project: Learning Journal

2. Git History

Git LogGit DiffGit ResetGit RevertGit StashGit Project: Messy Repository

3. Branches & History

Git BranchGit MergeGit Merge ConflictsGit RebaseGit Cherry-PickGit TagsGit Project: Feature Branch

4. Remotes and GitHub

Git RemoteGitHub AuthenticationGitHub RepositoryGitHub ForkGitHub IssuesGitHub PagesGit Project: Two Clone Sync

5. GitHub Collaboration

GitHub Pull RequestsGitHub Code ReviewGit Branching WorkflowGitHub Branch ProtectionGitHub CollaborationGitHub ContributingGit Project: Reviewed Pull Request

6. Automation and Professional Git

GitHub ActionsGit InternalsGit RecoveryGitHub SecurityGit Project: Team Repository CIProject
PREVIOUS LESSONGitHub Issues
NEXT · UNIT PROJECTGit Project: Two Clone Sync
4. Remotes and GitHub 60 min

GitHub Pages

Publish a versioned release from a tag and understand when Pages is a static site host rather than a substitute for Git.

What you will leave with

You will push a Git tag, create a GitHub Release that points at it, and turn on GitHub Pages for a tiny static site on a repository you own. You will not treat the website as Git history, and you will not open a pull request.

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.

GIT

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.

GITHUB

Release and Pages

A Release wraps the tag with notes. Pages copies committed HTML to https://OWNER.github.io/REPO/. GitHub created both features.

Do not move a published version tag to “fix the site”

Git Tags taught that consumers treat v1.4.0 as immutable. If the site is wrong, commit a fix and tag a new version. Do not delete and recreate v1.4.0.

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.0

Create 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.

QUICK CHECK

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.

QUICK CHECK

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.

QUICK CHECK

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.

Practice on a repository you own

Pages settings write to that GitHub project. Use the disposable remote. Do not enable Pages on a fork’s upstream or on a popular repository you do not maintain.

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

  1. 01
    Commit the static page

    On a repository you own, add docs/index.html. Push the default branch. Confirm git remote -v is your GitHub URL.

  2. 02
    Tag the site commit

    Annotated tag v1.4.0 (or another unused version) at that commit. git push origin v1.4.0.

  3. 03
    Create the Release

    gh release create with a one-paragraph note. Open the Releases tab and confirm it points at the tag.

  4. 04
    Enable Pages

    Deploy from the default branch, folder /docs. Open the github.io URL and read your heading.

  5. 05
    Refuse the wrong model

    Write one sentence: which URL is Git, which is the website, and why you will not move v1.4.0 if you later fix a typo.

Independent lab: release and Pages report

  1. On a GitHub repository you own, commit a tiny static page and push it.
  2. Create an annotated tag at that commit, git push origin that tag, and gh release create for it.
  3. Enable GitHub Pages from a branch (root or /docs) and open the live site.
  4. Write four lines: tag name, Release URL, Pages URL, and which of those three is a Git object rather than a GitHub page.
  5. Do not move the published tag, do not enable Pages on a project you do not maintain, and do not open a pull request.
Definition of done

You can push a Git tag, wrap it in a GitHub Release, serve the files with GitHub Pages, and explain that the website is not a substitute for Git history.

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.

Related lessons

  • Git Tags — GitHub Releases usually point at a Git tag.
  • GitHub Repository — Pages is a GitHub hosting feature on that repository.
  • GitHub Issues — Issues track work; they do not publish a site.
KNOWLEDGE CHECK

Check your GitHub Pages and Release model

Separate Git tags from GitHub Releases, treat Pages as a static host, and practice on a repository you own.

01What is GitHub Pages?
02What is a GitHub Release?
03Does enabling GitHub Pages replace git commit?
04Which command publishes one existing local tag named v1.4.0 to origin?
05Which command creates a GitHub Release for tag v1.4.0?
06Where should you enable practice Pages for this lesson?
07Why is GitHub Pages not a substitute for Git?
PREVIOUS LESSONGitHub Issues
NEXT · UNIT PROJECTGit Project: Two Clone Sync
ON THIS PAGEGitHub PagesTag, Release, and Pages are three jobsCommit a tiny static site firstPush the Git tag, then wrap itCreate the GitHub ReleaseEnable Pages as a static hostPages is not a substitute for GitGuided practice: tag, release, siteIndependent lab: release and Pages reportCommon Pages and Release mistakesLesson reviewKnowledge checkRelated lessons
Course contents