GIT   

Add and verify custom domain in GitLab pages website

This is a brief tutorial for setting up the GitLab pages website and adding a custom domain to it.

Step 1 – Go to Gitlab and Create a new project repository for your website.

Step 2 – Upload all the files to the repository.

Step 3 –  After uploading all files, go to the root of your repository and click the + sign and then select “New file” option.

Step 4 – Do not give any name to the file. Click on Select a Template Type Option and Select .gitlab-ci.yml

Step 5 – Now Click on Apply a Template dropdown and HTML option from the list.

Step 6 – Click on the Commit Changes Button.

Step 7 – Now Go to CI/CD option in the left sidebar menu.

Step 8 – Here you can see the process of your pipeline. Once it is passed, you are good to go.

Step 9 –  Go to Settings Option in the sidebar menu and Click Pages. Here you can see your website is live on Gitlab pages with the following URL structure.

https://your-namespace.gitlab.io/your-repository-slug

 

How to add a custom domain to your newly created Gitlab pages website.?

Step 1 – On Setting > Pages screen, Click on the New Domain button on the top right corner of the screen.

Step 2 – Enter your domain name in the textbox and click Create New Domain Button.

Step 3 – Repeat Step 1 and 2 if you want to add subdomain also.

Step 4 – Now get your domain verification code and create the following DNS records according to your choice in your domain name’s dashboard.

Step 5 – Once you added the DNS records correctly, Click the Save changes button and your website will be live on your new domain.

Add and verify main domain to GitLab pages

Record TypeHostValue
a@35.185.44.232
txt_gitlab-pages-verification-codegitlab-pages-verification-code=6e0b7e5f80d7c0542cg2gj0be3ffa340

 

Add and verify subdomain to GitLab pages

Record TypeHostValue
cnamesubdomainusername.gitlab.io
txt_gitlab-pages-verification-code.subdomaingitlab-pages-verification-code=6h0b7e5f80dhc0542cg2gj0be3ffa340

 

Add both main domain and subdomain to GitLab pages

Record TypeHostValue
a@35.185.44.232
txt_gitlab-pages-verification-codegitlab-pages-verification-code=6h0b7e5f80dhc0542cg2gj0be3ffa340
cnamesubdomainusername.gitlab.io
txt_gitlab-pages-verification-code.subdomaingitlab-pages-verification-code=6h0b7e5f80dhc0542cg2gj0be3ffa340

 

Need a helping hand in fixing your website issues?

If you are facing any problems in implementing these code snippets and tutorials, you can hire us to fix your website issues.

Hire Us