The steps mentioned in the GitLab documentation to verify the ownership of a subdomain don’t work if your domain’s DNS provider is Namecheap.
What doesn’t work:
CNAME record for the subdomain that points to
namespace.gitlab.io (where namespace is your GitLab username)
and defining a
TXT record with key
_gitlab-pages-verification-code.subdomain.domain.tld for it
A record for the subdomain and a
TXT record for it where the key is the subdomain name.
Here are steps needed to setup GitLab pages with a custom subdomain for Namecheap DNS:
Login to Namecheap and go
Account -> Domain List
Manage button for the desired domain
Advanced DNS tab
ADD NEW RECORD red plus button
Then add the following two DNS records for the subdomain:
5a. Create A record
22.214.171.124 (this is the IP address used by gitlab.io)
5b. Create TXT record
Make sure to change the value of the verification code
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx with what GitLab generated for you.
The same steps can be followed for a custom domain, just replace the
subdomain with the
Documentation can sometimes be wrong, outdated or not taking into consideration all possible cases.
You have to use critical thinking and find a solution in spite of what the docs says.