Linking Namecheap to GitLab Pages - the ultimate step-by-step guide

There is a number of resources online trying to explain how to link a domain purchased on Namecheap, to free hosting provided by GitLab Pages. Every single one fails to successfully achieve its goal, so I prepared an ultimate step-by-step guide for everyone facing this issue. Namecheap also sends an email to new users that purchased a domain telling them to ask any question aimed at Namecheap CEO. While I have pointed out in that email that they lack an official documentation on connecting a domain to GitLab pages, it all looks to me like that email is just a very efficient post-sale activity. namecheap+gitlab


You need to have some stuff up and running before you can start the procedure:

  1. A purchased domain on Namecheap
  2. A running instance of GitLab Pages which you use for your free hosting

In my case, the 1st point is my domain,, and the 2nd one is a repo that deploys a static website under, since trulex is my username on


  1. Open GitLab repository and go to Settings | Pages, and click on New Domain button
    1. Write down your domain into the input field and click Create New Domain button
    2. Copy the verification code’s part starting with gitlab-pages-verification-code=, which you will need for proving the ownership of your domain
  2. Head over to namecheap Advanced DNS configuration page
    1. Remove all host records. You can take a screenshot just in case you want to revisit default values in the future.
    2. Create three new records:
      1. Type Host Value TTL
        A Record @ Automatic
        CNAME Record <>. Automatic
        TXT Record @ gitlab-pages-verification-code=<your-verification-code> Automatic
      2. Make sure you don’t forget the trailing dot in CNAME Record’s value. Values to be replaced are denoted with <>.
  3. At this point you should be all set up. TLS certificate will be automatically provided by GitLab, if you marked the checkbox in GitLab configuration.

You can now enjoy serving your website under a custom domain bought at namecheap while using free hosting by Feel free to ask any questions if the procedure didn’t work for you.

See also