英文:
Does GitHub Pages allow to use a branch other than master or gh-pages?
问题
GitHub 帮助 显示了以下 GitHub Pages 的选项:
- gh-pages 分支
- master 分支
- master 分支 /docs 文件夹
那么我们可以使用名称不是 master 或 gh-pages 的分支吗?例如,是否有办法选择 GitHub Pages 的 "site" 分支?我尝试在设置中选择 site 分支,但没有看到这样的选项。那么我们只能使用 master 或 gh-pages 吗?这是否有文档记录?
<sub># 我想了解这一点,因为我在我的站点内容中使用了分支名称,想知道是否需要转义名称。</sub>
英文:
GitHub Help shows the following options for GitHub Pages:
- gh-pages branch
- master branch
- master branch /docs folder
Then can we use a branch whose name is not master or gh-pages? For example, is there any way to select a "site" branch for GitHub Pages? I tried to select the site branch in Settings, but did not see such option. So can we only use master or gh-pages? Is this documented somewhere?
<sub># I want to know this because I'm using the branch name in my site content and want to know if I need to escape the name.</sub>
答案1
得分: 3
"Update Sept. 2020: yes actually."
> ## "从任何分支构建和部署GitHub Pages"
>
> 使用GitHub Pages的存储库现在可以从任何分支构建和部署。
将发布到特殊的gh-pages
分支仍然与以往一样工作,但您现在可以选择存储库中的其他分支作为发布源。
此功能还删除了用户和组织页面必须具有master
分支的硬编码依赖关系。
英文:
Update Sept. 2020: yes actually.
> ## "Build and deploy GitHub Pages from any branch"
>
> Repositories that use GitHub Pages can now build and deploy from any branch.
Publishing to the special gh-pages
branch will still work the same as it always has, but you can now choose a different branch in your repository as the publishing source.
This functionality also removes the hardcoded dependency on user and organization pages having a master
branch.
Original answer:
<del>No, those are the tow official publication sources in term of branches.</del>
The docs
folder could be a submodule which then might be:
- the same repository
- any branch you want
That way, publishing your pages from docs/
could allow you to publish from any branch content.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论