By the end of today you can
- Connect your local repository to GitHub and push your commits
- Configure the public address and use a supplied publishing workflow
- Find a deployment’s status and verify the published pages
- Publish a reviewed update, and know where to look when it fails
Start from Chapter 6 (or companion branch chapter-06 in ssg-playground): on main, everything committed, the preview working.
Before you upload
You need internet access and a GitHub account. We use a public repository, which is free for Pages.
- Everything you committed becomes visible: source, history, and author details
- A page with
draft: trueis not on the website, but its Markdown is public - Review your Chapter 6 history before pushing it
Sign in from the terminal
Install GitHub CLI from cli.github.com, then:
gh --version
gh auth login --hostname github.com --git-protocol https --web --scopes workflow
gh auth setup-git
gh auth status- Sign in in the browser; the
workflowscope lets you push the workflow file - No password or token goes into your project files
- Your commit email is author information, not a login
Three addresses
| Address | Purpose |
|---|---|
github.com/YOUR-USERNAME/my-knowledge-site | Source and history |
YOUR-USERNAME.github.io/my-knowledge-site/ | The published website |
The one hugo server prints | Your local preview |
A project site has the repository name in its path.
Your source is on GitHub now, but nothing is published yet.
Why the path matters
- A site under
/my-knowledge-site/needs that prefix in its links - The layout’s
relURLalready adds it to navigation and the stylesheet - The article’s relative links were designed for this from the start
--minify shrinks the output; --panicOnWarning turns warnings into failures. The result goes to public/, which Git ignores.
Worth knowing
- An artifact is the packaged build result, passed from build to deploy
${{ ... }}belongs to GitHub Actions, not Hugo- GitHub supplies the credentials: never paste your own into the YAML
- Plain CSS, no theme: so no Node.js, Go modules, or Sass. A new theme may need them
From now on, every push to
mainpublishes.
Verify the real website
- Home and every navigation destination
- The first article, with its screenshot and checklist
- The project page and its link back to the article
- The footer’s About link, from a nested page
Open a nested page in a new tab and reload: no localhost, the right path. Then try a private window, signed out.
Publish one small improvement
Add to the article’s publishing checklist:
- Check the published page after deployment.git diff -- content/articles/first-learning-note/index.md
git add content/articles/first-learning-note/index.md
git diff --cached
git commit -m "Add a live-site check to the publishing checklist"
git pushWhen something goes wrong
| What you see | What to check |
|---|---|
Push rejected: workflow scope | gh auth refresh --scopes workflow |
| Push rejected: other commits | A README made online? Never force-push |
| No workflow appears | The file path, and that it was pushed to main |
| Builds locally, fails remotely | Hugo version, uncommitted files, filename case |
Completion check
- My branch is connected to the intended GitHub repository
- The repository holds source and history, not
public/ - I can tell the repository, preview, and public addresses apart
- Pages uses GitHub Actions, and both jobs succeeded
- I checked live pages, nested links, the stylesheet, and the image
- My checklist and About edits reached the live site
- I repaired the configuration error before committing anything else