Invalid CNAME record for GitHub Pages

To configure GitHub Pages with a custom domain, I need to create an record with <username> However, this cannot be done for me because myuser name ended with a hyphen. e.g., which failed with the follwoing error:

Content for CNAME record is invalid (Code: 9007)

What possibly can I do to resolve this, without changing my GitHub username?

That won’t be your hostname then. You first need to clarify with Github what your actual hostname is.

Though that cannot be either

Hi @sandro,

Thanks for you reply. Actually you maybe right. This maybe an design issue on the GitHub site.

You can check my GitHub profile here.

I think they changed the validation rule for the usernames.

Pinging [] with 32 bytes of data:
Reply from bytes=32 time=51ms TTL=57
Reply from bytes=32 time=51ms TTL=57
Reply from bytes=32 time=50ms TTL=57
Reply from bytes=32 time=51ms TTL=57


Fair enough, that seems to be a glitch on Github’s end. A hostname is not supposed to end with a hyphen, hence you cannot set it up. You could either change the username or set up an A record instead of a CNAME record, however in the latter case you’d need to regularly check if the IP address changed and update it.

Alternatively you could probably set up a CNAME record for a random username, as these seem to resolve to the same address, but that might change too.

You are right!

I added a CNAME record directly to and it does the trick. (Thanks to the CNAME Flattening.)


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.