GitHub Pages允许使用除了master或gh-pages之外的分支吗?

huangapple go评论59阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2020年1月3日 14:01:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/59573865.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定