Can I create more than one repository for github pages?
Solution 1
You can have one site published to https://<username>.github.io
by publishing to the master branch of a repository named “username.github.io” (substituting your actual username).
You can also have an additional site per GitHub project published to https://<username>.github.io/<project>
. Project settings let you choose which branch and directory to publish.
A better description is available in the GitHub Pages documentation, including options for using custom domain names.
(since April 2013, all username.github.com
are now username.github.io
)
Solution 2
No you are not limited, it is possible to have multiple GitHub Pages sites within one account. Create another GitHub repository and push your site files to the gh-pages branch. This would result in the site being hosted at tshepang.github.io/repo-name
Now, push another file "CNAME" to the same repository and branch and fill it with movies.tshepang.net. Log in to your DNS host and add the CNAME to point to "tshepang.github.io" (just like the original site).
This would allow you to have seemingly two different sites on different domains. This would not work for having two or more sub-domains within github.io itself.
Solution 3
There is a possibility to host multiple pages within the same repository having sub-pages if you are fine with code duplication.
The latest version of my website is hosted on http://username.github.io/REPONAME This is a screenshot of the structure of my root repository where I host the latest version of my website:
Inside folder "2.4.0" I can host a previous version of the same page ,which is then reachable at: http://username.github.io/REPONAME/2.4.0 This is the structure of the folder 2.4.0:
Using this methodology of sub-pages within a main page, you can host multiple sub-pages within one main page.
Solution 4
You can only create one
user or organization site for each GitHub account. Project sites, whether owned by an organization or a user account, are unlimited
.
GitHub Pages sites
There are three types of GitHub Pages sites:
project
, user
, and organization
. Project sites are connected to a specific project hosted on GitHub, such as a JavaScript library or a recipe collection. User and organization sites are connected to a specific GitHub account.
To publish a user site, you must create a repository owned by your user account that's named <user>.github.io
. To publish an organization site, you must create a repository owned by an organization that's named <organization>.github.io
. Unless you're using a custom domain, user and organization sites are available at http(s)://<username>.github.io
or http(s)://<organization>.github.io.
The source files for a project site are stored in the same repository as their project. Unless you're using a custom domain, project sites are available at http(s)://<user>.github.io/<repository>
or http(s)://<organization>.github.io/<repository>
.
The publishing source for your GitHub Pages site is the branch and folder where the source files for your site are stored. If the default publishing source exists in your repository, GitHub Pages will automatically publish a site from that source. The default publishing source for user and organization sites is the root of the default branch for the repository. The default publishing source for project sites is the root of the gh-pages
branch.
Akshat Jiwan Sharma
Song of the week This week it's a tie! Yeh hai Bombay meri jaan and Mack the knife [email protected]
Updated on September 26, 2021Comments
-
Akshat Jiwan Sharma over 2 years
I created a repository for hosting a blog on github.Is there any way that I can create more to host multiple blogs?Am I limited to just one repository for hosting(since username.github.com can only be used once?)
-
KieranPC about 5 yearsIt is now possible to have a page on the Master branch of any repository.
-
Krishna Oza almost 4 yearsStephen, what do you mean by
gh-pages
branch. I have pushed my website to master branch of such project repository as shared above in the answer however I get the errorThere isn't a GitHub Pages site here.
-
Krishna Oza almost 4 yearsI see only one branch i.e. master and no branch named
gh-pages
is created. -
Stephen Jennings almost 4 years@KrishnaOza By default you push GitHub Pages sites to a branch named “gh-pages” instead of “master“, but there is a repository setting to publish the master branch instead. See the documentation for choosing a publishing source for exact instructions.
-
Ozichukwu over 3 years@KrishnaOza you have to create the gh-pages branch yourself for it to work
-
idbrii almost 3 years"Project sites will publish whatever you push to the "gh-pages" branch by default." However, gh-pages is not automatically published as a page. You may need to go to Settings > Pages and ensure Source has both a branch and folder selected otherwise you'll get a 404.
-
Yash Chitroda almost 3 yearsFound this Ans helpful even after 8 years, 4 months.