Can't add my custom domain on Github Pages

Hello. Today, I purchased domain name “ishaanbhagat . com” and tried to connect GithubPages to it. It worked, but the repo I used was using a Jekyll Theme that looked quite bad, and I could not find a way to fix it, so I permanently deleted my repo called “ishaanbhagat.github .io”.

Later the same day, I created another repo with the same name, forked from a another user’s repo. However, at the Settings > Pages Menu, when I try to add “ishaanbhagat . com”, it says The CNAME ishaanbhagat . com is already taken. Check out https://docs.github.com/articles/troubleshooting-custom-domains#cname-errors for more information."

I have a feeling that the previous instance of the repository is still linked to the CNAME file with my domain, however, I am unable to access this repository as it had the same name as the new repository. The site itself shows this error code, presumably due to the linked repository being deleted.

BTW some links have spaces in them as a new user can only upload 2 links.

I do realize that it probably wasn’t the best idea to permanently delete the repository I intended on working on, but I would greatly appreciate any help you can give me. Do advise me on what to do so I can connect my domain to this new site.

It looks like something might have gone wrong with attaching your CNAME file and it looks like it’s in a strange state where it’s only half-linked to your site :thinking: This is likely due to the filename and contents being corrupted:

Can you try deleting this file and then attaching your custom domain to your site from the Pages section in your repository settings again?

Hi Thomas,

Thanks for your quick response. I tried deleting the file and then trying to attach the custom domain from Pages in settings, however, I’m still getting the same error as before 🥲. Do you have any other suggestions?

Fwiw, that’s a vim undo file:
https://vimhelp.org/vim_faq.txt.html#faq-7.2

If you’re still seeing this error then the best thing to do is probably to delete and recreate this repository. Make sure you clone a fresh version first so you can push it back up to GitHub so you don’t lose any of your work!

Hey Thomas,

I just did what you suggested, cloned a version of the repo, then deleted it and recreated with the cloned backup. However, I’m still getting the exact same error as before, saying that the domain name is already taken.

Is there any way for you to ‘wipe’ the domain name ishaanbhagat.com from Github Pages? If you go to the web address, it displays the following message

When I had purchased the domain name, the web address was basically blank. Hence, it looks like some remnant of a deleted repo or something of that nature is still linked to the web address. Am I correct in my thinking? If so, is there anything you can do on your side to ‘de-link’ the domain name?

Thanks a lot for your help with this,
Ishaan

Unfortunately not. Your site is in a stange state right now where Pages things your domain is attached but the CNAME file doesn’t exist inside your repository, which is very strange. Can you try creating this CNAME file manually and see if that helps? It should be a file called CNAME—no extension— with the following content:

ishaanbhagat.com

Can you try pushing that file to your repository and seeing if it fixes this?

Hi Thomas,

Thanks for your reply. Just tried creating and pushing the CNAME file, it seems to have done something but not exactly what I wanted. Now, when I try attaching my custom domain in Pages settings, I get the following message ‘No changes to custom domain.’

The message stays the same no matter how many times I click it, and the actual domain still shows the ‘404 Error’ Github Pages screen.

Do you have any suggestions for what I could try now?

Thanks again for your help,
Ishaan

Seems to be fixed, finally! I triggered a rebuild of your site from the backend and it looks like your domain has been attached correctly now :tada:

Not entirely sure what went on here. I’ll pass this on to the Pages team to investigate I think because it was especially strange, but your site should be working properly now.

2 Likes

Great, thanks so much for your help Thomas!