Reputation: 2737
So I am trying to get a custom domain to work with my github pages user site. I have followed pretty much the standard procedure for doing this as follows: (recommended by github here too: https://help.github.com/articles/setting-up-an-apex-domain-and-www-subdomain/). Note I need both the apex domain (example.com) and the www subdomain (www.example.com) to resolve to my github pages user site at username.github.io (the website itself is a jekyll based blog and I have checked that it compiles successfully before I started this process)
I have tried contacting my registrar and they said that everything in the DNS record seem fine and they get the following results:
A records :
example.com. 21460 IN A 185.199.111.153
example.com. 21460 IN A 185.199.109.153
example.com. 21460 IN A 185.199.110.153
example.com. 21460 IN A 185.199.108.153
CNAME :
www.example.com. 7199 IN CNAME username.github.io.
As expected.
But I still get the following error in github (under the settings tab of the repository):
"**Domain does not resolve to the GitHub Pages server. For more information, see https://help.github.com/articles/setting-up-a-custom-domain-with-github-pages/.**"
And when I try to access the site by typing either example.com or www.example.com, the browser redirects to https://example.com/ and I get the error (on Chrome):
ERR_CONNECTION_REFUSED
Note that there is a warning on the documentation by github saying:
Warning: If your domain has HTTPS enforcement enabled, GitHub Pages' servers will not automatically route redirects. You must configure www subdomain and root domain redirects with your domain registrar.
I have no idea how to get around this. I suspect this is the possible cause of the issue. So a solution might be to circumvent this redirection, I just do not know how I would do this.
Upvotes: 113
Views: 98580
Reputation: 605
I just want to add that this article helped me a lot.
Not only did I have to do the CNAME
, but I also had to do the 4 A
types, and the key was that I had to leave the host name blank (as opposed to "@"). This was for Google Domains. What was happening is that my www.haywarddatascience.com
worked, but my haywarddatascience.com
did not work. So big shout out to Samantha Ostrowski's article; that helped me get that last mile.
For everything else I used GitHub's own verification doc, first, and, then, its subdomain configuration doc, second.
Upvotes: 3
Reputation: 105
Go to hostinger or anyother in CNAME change :
username.github.io to www.username.github.io
Change the domain name from
example.com to www.example.com
And go to code edit CNAME file and add both
www.example.com
example.com
Upvotes: -1
Reputation: 2585
In my case, I update my index.html
but my page doesn't have an update.
After waiting for more than 36 hours, then I found that
Last deployed by @github-pages github-pages 8 months ago
So I change Build and deployment -> Source
from Deploy from a branch
to GitHub Actions
, then change back.
My home page updated.
Upvotes: 0
Reputation: 18248
Github shown me sucessive error message. After several iterations, github is happy with the following :
In Settings > Pages :set up your github page :
(you will have some error-warning message and Enforce HTTPS won't be ticked at first)
On my github repository's root, a CNAME
file with the website name (with www
):
www.example.com
www 28800 CNAME MYUSERNAME.github.io.
@ 21460 A 185.199.111.153
@ 21460 A 185.199.109.153
@ 21460 A 185.199.110.153
@ 21460 A 185.199.108.153
WAIT A DAY, ENJOY OUTDOOR WALK.
The website is ok and in my terminal, a dig
command returns :
$dig WWW.example.com +nostats +nocomments +nocmd
;WWW.example.com. IN A
WWW.example.com. 26728 IN CNAME MYUSERNAME.github.io.
MYUSERNAME.github.io. 1527 IN A 185.199.108.153
MYUSERNAME.github.io. 1527 IN A 185.199.111.153
MYUSERNAME.github.io. 1527 IN A 185.199.110.153
MYUSERNAME.github.io. 1527 IN A 185.199.109.153
Note: Replace example.com
and MYUSERNAME
by the values relevant to you.
Upvotes: 42
Reputation: 2737
For anyone stumbling across this. Actually I realized I have outlined the correct method to set this up with Github Pages. And this is in line with what is recommended by Github as of today and works perfectly well. Just make sure you wait for the DNS Propagation to take effect which in some cases might take up to 24hrs. And this is what the problem was in my case.
Upvotes: 133