Publishing on GitHub using github pages
GitHub Pages is available in public repositories with GitHub Free, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see “GitHub’s products.”
You can configure GitHub Pages to publish your site’s source files from master
, gh-pages
, or a /docs
folder on your master
branch for
Project Pages and other Pages sites that meet certain criteria.
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.
For more information about the different types of GitHub Pages sites, see “User, Organization, and Project Pages.”
/docs
folder on your master
branch
To publish your site’s source files from a /docs
folder on your master
branch, you must have a master
branch and your repository must:
-
have a
/docs
folder in the root of the repository -
not follow the repository naming scheme
<username>.github.io
or<orgname>.github.io
GitHub Pages will read everything to publish your site, including the
CNAME file, from the /docs
folder. For example, when you edit your
custom domain through the GitHub Pages settings, the custom domain will
write to /docs/CNAME
.
-
On GitHub, navigate to your GitHub Pages site’s repository.
-
Create a folder in the root of your repository on the
master
branch called/docs
. -
Under your repository name, click Settings.
- Use the Select source drop-down menu to select master branch /docs folder as your GitHub Pages publishing source.
Tip: The master branch /docs folder source setting will not appear as an option if the
/docs
folder doesn’t exist on themaster
branch.
- Click Save.