简体   繁体   English

您可以将多个自定义域添加到多个Github存储库吗?

[英]Can you add multiple custom domains to multiple Github repositories?

I know that you're able to create subdomains redirect to different repositories like: 我知道您可以创建子域名重定向到不同的存储库,例如:

example.com
foo.example.com

But are you able to do something like: 但你能做的事情如下:

example.com > foobar.github.io
differentdomain.com > foobar.github.io/different-repository

Or have some way to have a new custom domain redirect to a specfiic repository? 或者有一些方法可以将新的自定义域重定向到特定的存储库?

To have Github Pages at foobar.github.io you need a user (or "organiaztion") account at github.com/foobar and a repository at github.com/foobar/foobar.github.io . 有在Github上的页面foobar.github.io你需要一个用户(或“organiaztion”)帐户github.com/foobar ,并在仓库github.com/foobar/foobar.github.io

To have Github Pages at foobar.github.io/different-repository you need a branch gh-pages at github.com/foobar/different-repository . 有在Github上的页面foobar.github.io/different-repository你需要一个分支gh-pagesgithub.com/foobar/different-repository

To configure example.com to show foobar.github.io you add DNS records A to the domain pointing to Github Pages IP and add a file github.com/foobar/foobar.github.io/CNAME with content "example.com" (don't forget to add, commit and push). 要将example.com配置为显示foobar.github.io ,请将DNS记录A添加到指向Github Pages IP的域中,并添加内容为“example.com”的文件github.com/foobar/foobar.github.io/CNAME (不要忘记添加,提交和推送)。

To configure differentdomain.com to show foobar.github.io/different-repository you add DNS records A to the domain pointing to Github Pages IP and add a file github.com/foobar/different-repository/CNAME in gh-pages branch with content "differentdomain.com" (add, commit, push). 要配置differentdomain.com以显示foobar.github.io/different-repository ,请将DNS记录A添加到指向Github Pages IP的域中,并在gh-pages分支中添加文件github.com/foobar/different-repository/CNAME内容“differentdomain.com”(添加,提交,推送)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM