A Hugo website on your local machine that you are ready to publish
The baseURL in your site configuration must reflect the full URL of your GitLab pages repository if you are using the default GitLab Pages URL (e.g., https://<YourUsername>.gitlab.io/<your-hugo-site>/) and not a custom domain.
Configure GitLab CI/CD
Define your CI/CD jobs by creating a .gitlab-ci.yml file in the root of your project.
Next, create a new repository on GitLab. It is not necessary to make the repository public. In addition, you might want to add /public to your .gitignore file, as there is no need to push compiled assets to GitLab or keep your output website in version control.
# initialize new git repositorygit init
# add /public directory to our .gitignore fileecho"/public" >> .gitignore
# commit and push code to master branchgit add .
git commit -m "Initial commit"git remote add origin https://gitlab.com/YourUsername/your-hugo-site.git
git push -u origin master
Wait for Your Page to Build
That’s it! You can now follow the CI agent building your page at https://gitlab.com/<YourUsername>/<your-hugo-site>/pipelines.
After the build has passed, your new website is available at https://<YourUsername>.gitlab.io/<your-hugo-site>/.