How to add submodule into gh-pages branch & build static pages correctly?

后端 未结 3 1485
悲&欢浪女
悲&欢浪女 2021-02-08 00:47

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

Just copy t

3条回答
  •  孤城傲影
    2021-02-08 00:53

    I've got the answer from the Github (thanks @Robert).

    Using submodules with Pages

    If your repository contains submodules, they will automatically be pulled in when the Page is built.

    Make sure you use the https:// read-only URL for your submodules, including nested submodules. You can make this change in your .gitmodules file.

    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

    git@github.com:Kjuly/KYProjectPageTheme.git
    

    And it works perfect now!!


    Note, Old page said:

    HTTPS and SSH URLs will cause the build to fail with a "submodule fetch failed" error.

    Not sure whether the HTTPS one works or not now, but if the https:// not works for you, just keep using git:// instead.

提交回复
热议问题