【问题标题】:Adding github pages to all subfolders?将 github 页面添加到所有子文件夹?
【发布时间】:2020-07-18 07:54:01
【问题描述】:

我在 github 中有一个存储库,它将我所有的 Web 开发任务存放在单独的子文件夹中,例如:

VishnuVelukutty/CourseraWebdevAssignment(主)/module2-assignment(子文件夹)

所以主分支有 gh-pages,我想将 gh-page 添加到所有子文件夹(Assignment1,2,3 .....)独立,以便它们在特定模块链接时独立工作打开

是否可以将 gh-pages 应用于子文件夹?还是我为每个模块创建了独立的仓库?

我没有启动 .gitignore、静态站点、自述文件或主题,并通过 cobyismchrisjacob 引用了这篇文章,但我没有让它工作

这是我的github account to see if there any errors in setting up

这里的图片参考是git link

【问题讨论】:

    标签: github github-pages


    【解决方案1】:

    首先,确保创建一个gh-pages 分支,在其中添加至少一个提交并将其推送到您的 GitHub 存储库。

    那么,是的,您可以将 gh-pages 分支内容添加为当前存储库的子文件夹,在 master 分支中,使用 git submodule
    (除非,正如这里所解释的,你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
    

    您将拥有一个gh-pages 子文件夹,您可以随时更新:

    git submodule update --remote
    

    【讨论】:

    • 我以前多次使用过该技术:stackoverflow.com/a/40967706/6309
    • 我按照您提到的步骤进行操作,但仍然无法正确操作(因此,如果您可以查看我上面的 github 帐户并纠正我,那将非常有帮助)
    • @VishnuEzhuthachan 你的仓库看起来不错。您只需要在您的 gh-pages 分支/文件夹中添加一个 index.html 即可在您的 GitHub 页面中显示任何内容。
    • 但是索引文件在 module2-assignment 里面并且不显示
    • @VishnuEzhuthachan 我没有看到那个文件(例如github.com/VishnuVelukutty/CourseraWebdevAssignment)你有网址吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-12-15
    • 2019-05-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-01
    • 2011-04-30
    相关资源
    最近更新 更多