GitLab Pages

  1. Create a new repository named, where username is your username on GitLab. If you have already uploaded to other repo, rename the repo instead.
  2. Enable Shared Runners via Settings -> CI / CD -> Shared Runners.
  3. Push the files of your Hexo folder to the repository. The public/ folder is not (and should not be) uploaded by default, make sure the .gitignore file contains public/ line. The folder structure should be roughly similar to this repo.
  4. Check what version of Node.js you are using on your local machine with node --version. Make a note of the major version (e.g., v16.y.z)
  5. Add .gitlab-ci.yml file to your repo (alongside _config.yml & package.json) with the following content:
image: node:16-alpine
- node_modules/

- npm install hexo-cli -g
- npm install

- npm run build
- public
  1. should be up and running, once GitLab CI finishes the deployment job,
  2. (Optional) If you wish to inspect the generated site assets (html, css, js, etc), they can be found in the job artifact.

Project page

If you prefer to have a project page on GitLab:

  1. Go to Settings -> General -> Advanced -> Change path. Change the value to a name, so the website is available at It can be any name, like blog or hexo.
  2. Edit _config.yml, change the root: value from "" to "name".
  3. Commit and push.

Useful links