Note: Custom CNAMEs with TLS support were introduced in GitLab EE 8.5.
It's not required though, you can always use the standard GitLab Pages subdomain accessed under https://mynamespace.gitlab.io.
Features
Besides including your own domain, you can add your custom subdomain to your GitLab Pages project (e.g., subdomain.example.com)
You can enter more than one domain alias per project (e.g., example.com, example.net my.example.org and another-example.com pointing to your project under mynamespace.gitlab.io or mynamespace.gitlab.io/myproject). A domain alias is like having multiple front doors to one location.
If you want to enable an HTTPS secure connection to your domains, you can affix your own SSL/TLS digital certificate to each custom domain or subdomain you've added to your projects.
Steps to set up a custom domain
From your project's dashboard, go to Settings () > Pages > New Domain
Add your domain to the first field: mydomain.com
If you have an SSL/TLS digital certificate and its key, add them to their respective fields. If you don't, just leave the fields blank.
Click on Create New Domain.
Finally, access your domain control panel and create a new DNS A record pointing to the IP of GitLab Pages server:
mydomain.com A 35.185.44.232
Note: This GitLab Pages IP address for GitLab.com changed from 52.167.214.135 to 35.185.44.232 in August 2018.
Custom sub domains:
Alternatively, a similar procedure can be applied for custom subdomains:
Add the subdomain to the first field: subdomain.mydomain.com
Then create a new DNS CNAME record pointing to myusername.gitlab.io:
subdomain.mydomain.com CNAME myusername.gitlab.io
Repeat these steps for any additional domain aliases.
Note that how you set up your DNS records will depend upon which company you used to register your domain name. Every company has its own methods for DNS Zone Management. On this link you can find an overview for some providers, it might help you to follow through. Please contact your provider directly if you need some extra help.
Ordinarily, DNS propagation needs some time to take effect, so don't worry if you can't access your website under your custom domain instantaneously. Wait a few minutes and check it again
custom domain
Custom sub domains: