为什么 Github 页面的自定义域不为其他存储库提供页面?

Why is custom domain for Github pages not serving pages for other repositories?

Github 的 About custom domains and GitHub Pages 论坛阅读,

After you configure a custom domain for a user or organization site, the custom domain will replace the <user>.github.io or <organization>.github.io portion of the URL for any project sites owned by the account that do not have a custom domain configured. For example, if the custom domain for your user site is www.octocat.com, and you have a project site with no custom domain configured that is published from a repository called octo-project, the GitHub Pages site for that repository will be available at www.octocat.com/octo-project.

这正是我想要的。我为我的自定义域创建了一个家庭存储库 <user>.github.io(带有一个基本的静态 html 网站)并将自定义域 xyz.comwww.xyz.com 设置为指向 <user>.github.ioManaging a custom domain for your GitHub Pages site 中所述。这是它的样子。

我还在 xyz-repo 中添加了一个文件 CNAME,内容为 xyz.com。现在www.xyz.comxyz.com都指向xyz-rep中的html,完美。

问题是,我有另一个包含 Github 页面的存储库,我可以通过 <user>.github.io/other-repo-name 访问这些页面,但不能通过 xyz.com/other-repo-namewww.xyz.com/other-repo-name.

有什么帮助吗?

听起来像是您手动创建了 CNAME 文件。来自 https://help.github.com/en/github/working-with-github-pages/managing-a-custom-domain-for-your-github-pages-site

的文档

Under "Custom domain", type your custom domain, then click Save. This will create a commit that adds a CNAME file in the root of your publishing source.

我相信 Github 的系统会为您添加 CNAME 提交:不确定您这样做是否有效?或者它必须住在一个特定的分支中?我会尝试删除您手动创建的 CNAME 文件并使用配置 UI.