如何将子模块添加到gh-pages分支&正确建立静态页面? [英] How to add submodule into gh-pages branch & build static pages correctly?
问题描述
我有几个项目页面需要维护,并且它们都使用相同的主题(我将它打包到一个单独的回购中,称为 KYProjectPageTheme
)。
I have several project pages to maintain, and all of them use a same theme (I packaged it into a separate repo which called KYProjectPageTheme
).
只需将 KYProjectPageTheme
的整个文件夹复制到 gh-pages
分支的根目录dir&然后推送到Github工作得很好。
Just copy the KYProjectPageTheme
's entire folder to gh-pages
branch's root dir & then push it to Github works very well. I'll receive a notification when static pages build successfully.
但是,我想添加 KYProjectPageTheme
作为子模块在 gh-pages
分支下。这适用于我的本地机器。但是当我把它推到Github时,我再也收不到通知了!静态页面仍处于以前的状态,即我添加子模块后的修改不会影响。
However, I want to add KYProjectPageTheme
as a submodule under gh-pages
branch. This works well in my local machine. But when I pushed it to Github, I could not receive the notification anymore! And static pages are still in the previous state, i.e. modification after I've added a submodule did not affect.
我猜的是Github的静态页面生成器不起作用当 gh-pages
分支中有子模块时。但实际上,我不需要一个生成器来生成静态页面,我只需要在HTML&把它推到 gh-pages
。为什么不更新我的 index.html
?
What I guess is that Github's static page generator will not work when there's a submodule in gh-pages
branch. But actually, I don't need a generator to generate static pages, I just need to modify pages in HTML & push it to gh-pages
. Why not my index.html
updated?
有什么想法?是否有一些解决方法可以解决这个问题?
Any idea? Is there some workarounds to solve this issue?
提前致谢!
Thanks in advance!
推荐答案
Using submodules with Pages
If your repository contains submodules, they will automatically be pulled in when the Page is built.
我从Github得到了答案(谢谢@Robert)。 .github.com / articles / using-submodules-with-pagesrel =noreferrer>在Pages中使用子模块
如果您的存储库包含子模块,它们将在页面建立时自动被拉入。
Make sure you use the https://
read-only URL for your submodules, including nested submodules. You can make this change in your .gitmodules
file.
请确保您使用 https://
读取 - 仅适用于您的子模块的URL,包括嵌套的子模块。您可以在 .gitmodules
文件中进行此更改。
Submodules must also be served from public repositories, as the Pages server cannot access private repositories.
子模块还必须从公共存储库提供,页面服务器无法访问私人存储库。
So, I need to use
所以,我需要使用
https://github.com/Kjuly/KYProjectPageTheme.git (new page recommends to use "https://")
git://github.com/Kjuly/KYProjectPageTheme.git (old page recommends to use "git://")
instead of
而不是
And it works perfect now!!
它现在完美了!
strong>,旧页面说:
$ b
HTTPS and SSH URLs will cause the build to fail with a "submodule fetch failed" error.
HTTPS和SSH URL会导致构建失败并显示子模块读取失败错误。 // 不适合你,只保留usi ng
git://
代替。
Not sure whether the HTTPS one works or not now, but if the https://
not works for you, just keep using git://
instead.
这篇关于如何将子模块添加到gh-pages分支&正确建立静态页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!