If you're hosting a website on GitHub Pages, you can connect a custom domain to make it look more professional—and it's completely free. Here's a step-by-step guide to get your live site up and running with a personalized web address.
First, ensure your GitHub Pages site is already published and accessible via the default username.github.io URL. Then, you need to configure your custom domain's DNS settings. Log in to your domain registrar (e.g., Namecheap, GoDaddy, Google Domains) and create the following DNS records:
- A records: Point to GitHub Pages' IP addresses:
185.199.108.153,185.199.109.153,185.199.110.153,185.199.111.153. - CNAME record: If using a subdomain (e.g.,
www.example.com), point it toyourusername.github.io.
Next, go to your GitHub repository's Settings > Pages. Under "Custom domain," enter your domain (e.g., example.com). GitHub will automatically create a CNAME file in your repository. Save the settings, and wait for DNS propagation (could take up to 48 hours but often minutes).
Once propagation is complete, visit your custom domain—you should see your GitHub Pages site live. For extra security, enable HTTPS enforcement in the same GitHub Pages settings. That's it! You now have a free, custom-domain website hosted with GitHub Pages.