I was recently introduced to the wonder of hosting free gh-pages on github. I was able to create a few gh-pages branches for repos on my github account and had no trouble sharing and distributing links like "my_username.github.io/my_repo" and "my_username.github.io/my_other_repo". Then I learned that I could make a nice landing page by creating a repo called "my_username.github.io". All of the links worked perfectly.
I started to run into trouble when I wanted to set up a custom domain for my_username.github.io. I purchased "my_domain.com" and followed all of the instructions here. When I visit "my_domain.com", I see the content from "my_username.github.io" .... Nice! However, when I visit "my_domain.com/my_repo", I get the github 404 page saying "there isn't a github page here". When I visit "my_username.github.io/my_repo", it redirects to "my_domain.com/my_repo" and displays the same 404 page. At namecheap.com (where I purchased the "my_domain.com"), I have:
@ 204.232.175.78 A (address)
www my_username.github.io CNAME (alias)
Then in the root of the repo "my_username.github.io" I have a file called CNAME that only contains the text "my_domain.com".
I can't seem to figure out what is wrong as this setup seems to work as intended for others. One possible culprit is that my github username is in CapitalizedCamelCase.
Anyway, I was wondering if anyone else had worked through a similar issue and had some advice. If it helps, here is a link to the actual repo in question:
https://github.com/ScottLNorvell/ScottLNorvell.github.io
Thanks!
Head over to GitHub and create a new public repository named username.github.io, where username is your username (or organization name) on GitHub. If the first part of the repository doesn't exactly match your username, it won't work, so make sure to get it right.
GitHub Desktop users In the File menu, click Options. In the Options window, verify the following: To view your GitHub username, click Accounts.
If you're having trouble connecting to GitHub, you can troubleshoot your connection, then use the GitHub Debug tool to diagnose problems. Most often, connection problems occur because a firewall, proxy server, corporate network, or other network is configured in a way that blocks GitHub.
To access the page go to username.github.com/projectname . Any change you make to the gh-pages branch will be reflected there. There is also a link published in a repo's Settings > Github Pages.
Now that you have a custom domain, your project pages are available at yourcustomdomain.com/project_page
.
When you setup a GH Pages site for username.github.io
and use a custom domain, you can no longer access project pages from username.github.io/project_page
, but you can access them from yourcustomdomain.com/project_page
directly. While there is a redirect in place for username.github.io => yourcustomdomain.com
, there is no redirect for username.github.io/project_page => yourcustomdomain.com/project_page
so you should point all links/traffic for your project pages directly to yourcustomdomain.com/project_page
.
More info on custom domains for GitHub Pages and automatic redirects here: https://help.github.com/articles/setting-up-a-custom-domain-with-pages#automatic-redirects
Also, please note that you should not be using both a CNAME and A record from your DNS provider, only the A record. You should remove the CNAME record from your DNS providers settings because that is handled on GitHubs servers via the CNAME file you have in the root of your pages repo.
NOTE: I work at GitHub. Let me know if you still have trouble.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With