GitLab Pages advantages over GitHub Pages
|site generator||any||Jekyll only|
|Jekyll plugins||any||only whitelisted|
|domain aliases||multiple||only one|
GitLab Pages quick setup
- create a new Project named
username.gitlab.io(put your GitLab username in for “username”)
- Import from GitHub (or other) OR create/copy in your existing static website (if you had a GitHub Pages website, copy it here). If the latter, clone to your PC.
- on the GitLab project page e.g.
Set up CI
- you’re automatically creating a
.gitlab-ci.ymlfile. Under the “apply a GitLab CI Yaml template” pick appropriate for your site. If you’re coming from GitHub Pages it’s probably Jekyll.
- Your site is now building, as seen with the Pipelines tab of your website project. It takes about 3-4 minutes to install the gems for a Jekyll site, then 2-3 more minutes to complete the build depending on the size of your website. The public URL should be
username.gitlab.io. If it’s not found, be sure you name your repo
- Once you can browse
username.gitlab.io, in your Project Settings → Pages add TWO new domains if you have paid for your own domain name (here using
- This step can take your website down–do this at low traffic times. Once you’re satisfied it works, you can setup/transfer DNS to GitLab. Suppose your domain is
example.com, then set your DNS records to
example.com CNAME username.gitlab.io www CNAME username.gitlab.io
assuming your DNS provider supports CNAME flattening such as Cloudflare.
GitLab Pages used with for example Cloudflare works well to provide HTTPS with your custom domain name as per this procedure. With that procedure you can enable SSL “Full (Strict)” security.
The free GitLab accounts currently give 2000 minutes/month build “pipeline” time. For a moderate sized website, let’s assume 5 minutes build time. So you could do 400 pushes/month or 13 pushes/day on average–that should be enough for a small to moderate website.
You can cancel pipelines / runs to save wasted builds if you made a push and then are making another push right after.
Private source repo
Both GitLab and GitHub allow the source files (e.g. Markdown) to be private for a public website.
GitHub requires a paid subscription to have one or more private repos, while GitLab gives free private repos.
You should have a private website repo. Otherwise Google may present search results from your website repo Markdown code instead of or alongside the rendered webpages!
- You could build on your laptop (or cloud service like Wercker) with any static generator such as Hugo and push HTML to GitHub Pages.
- Useful Jekyll plugins that GitHub doesn’t whitelist include
jekyll-archives(page per category/tag)