无法在GitHub Pages中更改源分支 [英] Unable to change source branch in GitHub Pages
问题描述
我为GitHub Pages创建了一个简单的网站.该网站的来源位于主"分支中,而生成的网站(我希望看到的发布内容)位于"gh-pages"分支中.
I have created a simple web site for GitHub Pages. The source of the site is in the "master" branch and the generated web site (what I want to see published) is under the "gh-pages" branch.
我希望能够在设置中更改网站的来源.但是,设置是灰色的吗?我无法更改(请参见下面的屏幕截图).我究竟做错了什么?如何切换到"gh-pages"分支?
I was expecting to be able to change the source of the site in the settings. However, the setting is grayed out? I cannot change it (see screenshot below). What am I doing wrong? How do I switch to the "gh-pages" branch?
推荐答案
个人站点或组织站点是从master
构建的. gh-pages
分支用于构建项目的站点.
Personal or organization sites are built from master
. gh-pages
branch is used to build sites for projects.
据我所知,您正在使用 https://user-name.github.io /网址,这是一个个人网址,这就是master
分支是默认网址的原因.
As far as I can see, you're using https://user-name.github.io/ url, this is a personal one, so that's why master
branch is the default one.
请参见文档页面
如果您的网站是具有名为
<username>.github.io
或<orgname>.github.io
的存储库的用户或组织页面,则您不能从其他位置发布网站的源文件.具有这种存储库名称类型的用户页面和组织页面仅从master分支发布.
If your site is a User or Organization Page that has a repository named
<username>.github.io
or<orgname>.github.io
, you cannot publish your site's source files from different locations. User and Organization Pages that have this type of repository name are only published from the master branch.
因此答案是否定的,您无法更改.您必须调整工作流程,并在另一个分支中进行开发(将其称为development
),并在准备发布时合并到master
.
So the answer is No, you can not change it. You'll have to adjust your workflow and keep development in another branch (let's call it development
) and merge to master
when you're ready to publish.
UPD: It's 2020 out there, so as of July 31st GitHub Pages allow you to configure any branch to act as an old master
这篇关于无法在GitHub Pages中更改源分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!