GitLab Pages vs GitHub Pages: feature matrix
|site generator||any||Jekyll only|
|Jekyll plugins||any||only whitelisted|
|domain aliases||multiple||only one|
- GitHub Pages is substantially easier to setup and use, and is capable of medium websites getting several million hits / year
- GitLab Pages (setup described below) has more features and flexibility for advanced users
GitLab Pages quick setup
- create a
new GitLab Project
username.gitlab.io(put your GitLab username in for “username”)
- [if you already have a GitHub Pages website] Import from GitHub 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.
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.
For frequently updated, medium sized websites (hundreds or thousands of pages) it can be better to build the site locally on your PC or on a CI and then deploy to GitLab, because you can run out of free GitLab Runner quota before the month is over.
Private source repo
Both GitLab and GitHub allow the source files (e.g. Markdown) to be private for a public website. 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)