How to add a domain to github #192397
-
|
Hi, I've just bought a new domain. How do I add it to a GitHub repo? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Thank you for your interest in contributing to our community! We currently only accept discussions created through the GitHub UI using our provided discussion templates. Please re-submit your discussion by navigating to the appropriate category and using the template provided. This discussion has been closed because it was not submitted through the expected format. If you believe this was a mistake, please reach out to the maintainers. |
Beta Was this translation helpful? Give feedback.
-
|
Phase 1: Preparation on GitHub Open your GitHub repository and go to Settings. On the left sidebar, click Pages. Under the Custom domain section, type your domain (e.g., www.yourdomain.com) and click Save. Note: This creates a CNAME file in your repository automatically. Phase 2: Configure Your DNS Provider
185.199.108.153 185.199.109.153 185.199.110.153 185.199.111.153
Type: CNAME Host/Name: www Value/Target: yourusername.github.io (Replace with your actual GitHub URL). Phase 3: Verification and Security Check the status: In the Pages settings, GitHub will show a message saying "DNS check successful" once the changes propagate. Patience is key here; it can take anywhere from a few minutes to 24 hours. Enforce HTTPS: Once the DNS is verified, check the box for Enforce HTTPS. This ensures your site is secure and avoids "Not Secure" warnings in browsers. |
Beta Was this translation helpful? Give feedback.
Phase 1: Preparation on GitHub
Before touching your domain provider, you need to tell GitHub which domain to expect.
Open your GitHub repository and go to Settings.
On the left sidebar, click Pages.
Under the Custom domain section, type your domain (e.g., www.yourdomain.com) and click Save.
Note: This creates a CNAME file in your repository automatically.
Phase 2: Configure Your DNS Provider
Now you need to tell the "phonebook" of the internet (your DNS provider like Namecheap, GoDaddy, or Google Domains) to point to GitHub.
To point your main domain to GitHub, you need to add A Records that point to GitHub’s IP addresses. Create four A records with the …