Git & GitHub / GitHub Pages and Hosting
Setting Up Custom Domains for Pages
This tutorial will walk you through the process of setting up a custom domain for your GitHub Pages site. We will cover how to purchase a domain, configure your GitHub repository …
Section overview
5 resourcesCovers deploying static websites using GitHub Pages.
Introduction
In this tutorial, we will guide you through the process of setting up a custom domain for your GitHub Pages site. By the end of this tutorial, you will be able to purchase a domain, configure your GitHub repository to use your custom domain, and verify your domain with your DNS provider.
Prerequisites:
- Basic knowledge of GitHub
- Basic understanding of DNS (Domain Name System)
Step-by-Step Guide
Purchasing a Domain
- You can purchase a domain from any domain registrar of your choice such as GoDaddy, Google Domains, Namecheap etc.
- Follow their specific instructions to purchase the domain.
Configuring Your GitHub Repository
- Navigate to your GitHub repository and click on
Settings. - Scroll down to the
GitHub Pagessection. - In the
Custom domainbox, type the name of your newly purchased domain and clickSave.
Verifying Your Domain with Your DNS Provider
- Go to your domain registrar's website and sign in.
- Navigate to your domain's DNS records.
- Add a CNAME record for
wwwthat points toYOUR-USERNAME.github.io, replacingYOUR-USERNAMEwith your actual GitHub username. - Add four A records that point to the following IPs:
- 185.199.108.153
- 185.199.109.153
- 185.199.110.153
- 185.199.111.153
Code Examples
Example of a CNAME Record
www 3600 IN CNAME YOUR-USERNAME.github.io.
www: the subdomain for which the record is valid.3600: the time (in seconds) that the record is cached by DNS resolvers.IN: signifies that this is an Internet record.CNAME: the type of DNS record.YOUR-USERNAME.github.io: the domain the record points to.
Example of an A Record
@ 3600 IN A 185.199.108.153
@: signifies that this is the record for the root domain.3600: the time (in seconds) that the record is cached by DNS resolvers.IN: signifies that this is an Internet record.A: the type of DNS record.185.199.108.153: the IP address the record points to.
Summary
In this tutorial, we've covered how to purchase a domain, how to configure your GitHub repository to use your custom domain, and how to verify your domain with your DNS provider.
For further learning, it would be beneficial to understand more about DNS and how it helps in the process of domain name resolution.
Practice Exercises
- Purchase a domain and create a simple GitHub pages website.
- Point your domain to your GitHub pages website.
- Verify if your domain is correctly pointed to your GitHub pages website.
Remember to continually practice your skills and explore different aspects of web development. Happy coding!
Need Help Implementing This?
We build custom systems, plugins, and scalable infrastructure.
Related topics
Keep learning with adjacent tracks.
Popular tools
Helpful utilities for quick tasks.
Latest articles
Fresh insights from the CodiWiki team.
AI in Drug Discovery: Accelerating Medical Breakthroughs
In the rapidly evolving landscape of healthcare and pharmaceuticals, Artificial Intelligence (AI) in drug dis…
Read articleAI in Retail: Personalized Shopping and Inventory Management
In the rapidly evolving retail landscape, the integration of Artificial Intelligence (AI) is revolutionizing …
Read articleAI in Public Safety: Predictive Policing and Crime Prevention
In the realm of public safety, the integration of Artificial Intelligence (AI) stands as a beacon of innovati…
Read articleAI in Mental Health: Assisting with Therapy and Diagnostics
In the realm of mental health, the integration of Artificial Intelligence (AI) stands as a beacon of hope and…
Read articleAI in Legal Compliance: Ensuring Regulatory Adherence
In an era where technology continually reshapes the boundaries of industries, Artificial Intelligence (AI) in…
Read article