How to add a custom domain to a GitHub Page

I love programming and I work as a Software Engineer developing web based applications and mobile apps. I'm a full stack developer, from the backend where I primarly use Node.js and MySQL on Linux Servers to the frontend where I use modern web technologies and CSS frameworks. I love to develop mobile app, especially in Android mainly in Java, and in the last year I'm using Flutter, first to experiment and in the last period to develop cross platform enterprise apps. In my spare time I like to experiment on side projects apps, ui designs, web app to improve my skills and test new ideas.
Hi everyone, in this article I want to show you how to add a custom domain to a GitHub Page when you want to level up your (side)project with a domain name. I discovered these steps last week when I register a domain for one of my sideproject which is hosted on a GitHub Page, some steps are related to GitHub others to your domain and in particular the DNS.
GitHub Configuration
In your GitHub repo go to the Settings tab, scroll down until you reach GitHub Pages -> Custom domain, and insert here your custom domain name, in my case it's covid19trackerita.it

Create in you repo a CNAME file and insert the same domain name

Domain Configuration
On your domain provider, you have to change some configuration about your DNS. You have to create four A records and one CNAME record
| Domain | TTL | Type | Target |
| covid19trackerita.it. | 0 | A | 185.199.108.153 |
| covid19trackerita.it. | 0 | A | 185.199.109.153 |
| covid19trackerita.it. | 0 | A | 185.199.110.153 |
| covid19trackerita.it. | 0 | A | 185.199.111.153 |
| www.covid19trackerita.it. | 0 | CNAME | polilluminato.github.io. |
The dot at the end of all domain names is mandatory otherwise the configuration will not work.
Now you have to wait some hours, at most one day, and you will be able to access your GitHub Page using your custom domain.
Bonus Tip
When all it's OK you can also add an SSL Certificate to your web page, in your GitHub repo go to the Settings tab, scroll down until you reach GitHub Pages -> Enforce HTTPS and enable it!
Simple, isn't it? Alberto




