大网数据广告活动
网站运营与故障问答

TXT DNS record for static GitHub site

· 52CE 我爱测

Context I'm playing with basic hosting and DNS. I have a static page hosted at example.github.io which is referenced by a CNAME at example.com which is the URL I want visitors to see. I want to use various tools (Google Search Co…

问题原文

原帖链接 · blackboxlogic · CC BY-SA 4.0

Context

I'm playing with basic hosting and DNS. I have a static page hosted at example.github.io which is referenced by a CNAME at example.com which is the URL I want visitors to see.

I want to use various tools (Google Search Console, Bing Webmaster Tools, KeyBase proof) which require I prove ownership of the domain by adding a TXT record with a unique identifier for each service.

I've added the TXT records to example.com but it "isn't working"*, which makes some sense to me, since CNAME and TXT records can't cohabitate. I haven't found a way to add TXT records directly to the GitHub page since the name server isn't under my control.

"Isn't Working"

The webmaster tools find the TXT record, but are not showing any information about the site or its content, as if they aren't finding it. KeyBase has told me that it doesn't see the TXT record at all (it worked momentarily when I removed the CNAME, but that broke the site).

Questions

  • Is it possible to add TXT records to a static site hosted on GitHub?

  • Have I revealed some fundamental misunderstanding about DNS, and can you point it out where I've gone astray?

  • Is this just not possible?

已采纳解答

原帖链接 · Stephen Ostermiller · CC BY-SA 4.0

You can't use a CNAME at your domain apex (the @ record for no subdomain) regardless of whether or not you also want TXT records. It breaks all other needed records like NS, SOA, and MX records. DNS servers shouldn't even allow you to put a CNAME record at the apex. If you manage to do so, things break subtly. For example your domain's email will not be properly delivered.

Instead of using a CNAME you need to use A, AAAA, or ALIAS records according to instructions from Github.

Once you have properly configured your DNS such that it doesn't have a CNAME record at the apex, you can add TXT records to verify your site.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2020-09-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。