Skip to content

Step-by-Step Guide to Publishing GitLab Pages at a IONOS Domain Provider

Adding a custom domain to GitLab Pages involves two main steps:

  1. Adding the Custom Domain in GitLab.

  2. Verifying the Domain Ownership.

Let me walk you through the process in detail.

Step 1: Adding a Custom Domain to GitLab Pages

  1. Go to Your Project in GitLab:

    • Navigate to your project where GitLab Pages is set up.
  2. Access Pages Settings:

    • Go to Settings > Pages in the left-hand menu.
  3. Add a New Domain:

    • Under the Domains section, click New Domain.
    • Enter your custom domain (e.g., gridlab.io or docs.gridlab.io).
    • Click Create New Domain.

Step 2: Verifying Domain Ownership

GitLab may require you to verify domain ownership to ensure you have control over the domain. Here’s how to do it:

  1. Verification Method:

    • GitLab provides a TXT record for domain verification.
    • After adding the custom domain in GitLab, you’ll see a TXT record under the domain details in the Pages settings.
  2. Add the TXT Record:

    • Go to your IONOS DNS provider and add the TXT record provided by GitLab.
    • For example:
      • Name: _gitlab-pages-verification-gridlab.io
      • Value: gitlab-pages-verification-code=
  3. Wait for DNS Propagation:

    • DNS changes can take a few minutes to several hours to propagate..
  4. Wait for DNS Propagation:

    • Once the TXT record is propagated, GitLab will automatically verify the domain.
    • You’ll see a green checkmark next to the domain in the Pages settings indicating successful verification.

Step 3: SSL/TLS Configuration

  1. Automatic SSL:

    • GitLab Pages automatically provisions SSL certificates for your custom domain via Let’s Encrypt.
    • Ensure that your DNS records are correctly set up before enabling SSL.

By following these steps, you can successfully add a custom domain to your GitLab Pages and verify domain ownership.

Step 4: Set up DNS records

Login into your IONOS account and select the domain you want to use for your Githu

Then go to your domain DNS configuration panel:

  1. Delete all existing DNS records:

    • You need to delete all existing A and AAAA records for the @ host and replace them with the IP addresses for GitLab Pages A records.

After they are all deleted, you need to click on Add registry to create the new A records pointing to the GitLab Pages IPs.

  1. Add GitLab Pages DNS record:

    • Type: A
    • Hostname: @
    • Points to: 35.185.44.232
    • TTL: 1 hour (default value)
    • Add a DNS registry for www: disabled

Info

It’s VERY important that Add a DNS registry for www option is disabled

After creating the new DNS record for GitLab Pages IP address we have to add redirection. This time a CNAME record pointing to your <GITLAB_USERNAME>.github.io.

  1. Add GitLab Pages DNS record:

    • Type: CNAME
    • Hostname: www
    • Points to: .github.io.
    • TTL: 1 hour (default value)
  2. Wait for DNS Propagation

And that’s all.