Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 726
Greg Wolff Avatar asked Aug 06 '17 00:08

Greg Wolff


People also ask

Can you have more than one website on GitHub Pages?

You can only create one user or organization site for each account on GitHub. Project sites, whether owned by an organization or a personal account, are unlimited.

How many static sites can I host GitHub?

Only one Static HTML file can be deployed with one repository in Github.

Can you have multiple repositories on GitHub?

With Git, using multiple repositories is the only way to work efficiently. This enables each team to work independently, and do their work faster. You can also make sure that developers only have access to the repositories they need access to (thus making Git more secure.)

Is there a limit to the number of repositories on GitHub?

So, is there any limit on GitHub repo count or is there any other way to handle this? The number of repositories owned by an organization is unlimited.


1 Answers

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.

To have Github Pages at foobar.github.io/different-repository you need a branch gh-pages at github.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).

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).

like image 197
phd Avatar answered Nov 13 '22 01:11

phd