Reputation: 464
My Hugo site starts locally, but only returns a 404.html page when hit on GitHub Pages.
I've tried re-instantiating the repo, rebuilding the site with different commands, pushing and deploying with the Hugo deploy script, and rm -rf
the public folder and re-adding it.
Repository: https://github.com/jschalz/jschalz.github.io
When following the tutorial, running git submodule add -b master git@github.com:jschalz/jschalz.github.io.git public
:
'public' already exists in the index
Currently hosted at https://jschalz.github.io
.
I'd expect the site to come up with my pages (and I definitely have non-draft pages on there), but it's only returning 404.html. It's possible it's because I renamed the repo at one point, but I'm not sure. Troubleshooting ideas are very appreciated.
UPDATE: The issue was that I didn't have an index.html, index.xml, or README.md in my repo. Fixed.
Upvotes: 4
Views: 3325
Reputation: 1328942
2022: A different approach uses now GitHub Actions, since those are the default to build GitHub pages, since Aug. 2022.
Hence the new section "Build Hugo With GitHub Action" and the GitHub actions/hugo-setup
.
Original answer 2019:
The issue was that I didn't have an
index.html
,index.xml
, orREADME.md
in my repo. Fixed.
Not exactly fixed.
The point of the tutorial was:
git submodule add -b master git@github.com:<USERNAME>/<USERNAME>.github.io.git public
This creates a git submodule.
Now when you run thehugo
command to build your site topublic
, the createdpublic
directory will have a different remote origin (i.e. hosted GitHub repository).
Meaning what you should be pushing if, from your public
subfolder, only what Hugo has generated.
You should not push your Hugo project (config.toml
, themes
, and so on): those should be pushed in a separate GitHub repository for safekeeping and versionning.
Upvotes: 1