Gitlab pages 404 - help?

I’ve followed the tutorial:

I’ve tried the submodule pre-script from here:

I’ve tried un-git-ing the theme so that it doesn’t need to deal with submodules, as suggested elsewhere on here…

…but I’m still getting build failures and a 404. (same error with or without submodule pre-script.)

Running with gitlab-runner 11.1.0-rc2 (83bc9589)
  on docker-auto-scale fa6cab46
Using Docker executor with image monachus/hugo ...
Pulling docker image monachus/hugo ...
Using docker image sha256:7193ac87097a9d7d2a5126b3f95bfdc9ae768ace448a83a41faf5a9b7f646993 for monachus/hugo ...
Running on runner-fa6cab46-project-7561004-concurrent-0 via runner-fa6cab46-srm-1532061739-1d9b43ee...
Cloning repository...
Cloning into '/builds/rawwerks/phd-to-ceo-squeeze'...
Checking out f071441a as master...
Updating/initializing submodules recursively...
$ git submodule init
$ git submodule update --force
$ hugo
Building sites … 
Total in 8 ms
Error: Error building site: readDir: open /builds/rawwerks/phd-to-ceo-squeeze/content: no such file or directory
ERROR: Job failed: exit code 1

Any thoughts? Here is my .gitlab-ci.yml

image: monachus/hugo


before_script:
  - git submodule init
  - git submodule update --force

variables:
  GIT_SUBMODULE_STRATEGY: recursive

pages:
  script:
  - hugo
  artifacts:
    paths:
    - public
  only:
  - master

(The site works beautifully locally w/ ‘hugo server’)

Based on the error there doesn’t seem to be a content directory. If you’re unable to ssh into your CI environment to debug (looks like this isn’t possible on GitLab CE) try running hugo with the -v flag to see more verbose output or building off monachus/hugo using Docker locally to try and reproduce.

Possibly related: https://github.com/gohugoio/hugoThemes/issues/387

1 Like

well that did the trick, thank you @anon94969202! for those that follow - i added .gitkeep to the (empty) content directory of the project, and the build passed. thanks again.

(also, it took about 5 minutes for the corresponding page to stop 404-ing…so if you’re having this problem be patient with gitlab)

New problem! Gitlab pages w/ Hugo is working with a straight http://, but I can’t get www. to map correctly to my site.

Here’s how my A records are set up in DO:

This DNS configuration has worked for me in the past with self-hosted Hugo sites, but it is not working with Gitlab Pages.

Here is the repo for reference: https://gitlab.com/rawwerks/phd-to-ceo-squeeze/

Any help would be really appreciated!

Your Hugo looks fine, but maybe you have to configure gitlab pages properly. Make sure you add both domain (www and non www) in Settings > Pages > New Domain

1 Like

Great suggestion! That did it for www.phdtoceo.com - thank you. Took about 20 minutes for the changes to propagate on the GitLab site of the house…I was not patient enough in my first reply.

35%20PM

Glad to hear that you solved the problem. To make this forum neat and clean feel free to create new post rather than replying in the old post that have no relation with the new request/support :wink: