首页 > 解决方案 > Adding github pages to all subfolders?

问题描述

I have a repository in github which will house all of my web development assignments in separate sub-folders like :

VishnuVelukutty/ CourseraWebdevAssignment (master)/ module2-assignment (subfolder)

So the master branch has gh-pages and I want to add the gh-page to all sub-folders (Assignment1,2,3 .....) independently so that they work independently when the specific module-link is opened

Is it possible to apply gh-pages to a subfolder ? or do I have create independent repo for each module ?

I have not initiated .gitignore, static site, readme nor theme and reffered to this post by cobyism and chrisjacob but i didn't get it working

Here is my github account to see if there any errors in setting up

For reference of the images here is the git link

标签: githubgithub-pages

解决方案


First, make sure to create a gh-pages branch, add at least one commit in it and push it to your GitHub repository.

Then, yes, you can add that gh-pages branch content as a subfolder of your current repository, in the master branch, using git submodule.
(unless, as explained here, you chose the master branch itself as source for GitHub Pages)

git checkout master
git submodule add -b gh-pages -- /remote/url/of/your/own/repo gh-pages
git commit -m "Add gh-pages branch as submodule"
git push

You will have a gh-pages subfolder, that you can update at any time with:

git submodule update --remote

推荐阅读