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."
Default source settings for repositories without the username naming scheme
The default settings for publishing your site's source files depend on your site type and the branches you have in your site repository.
If your site repository doesn't have a master
or gh-pages
branch, your GitHub Pages publishing source is set to None and your site is not published.
After you've created either a master
or gh-pages
branch, you can set one as your publishing source so that your site will be published.
If you fork or upload your site repository with only a master
or gh-pages
branch, your site's source setting will automatically be enabled for that branch.
master
or gh-pages
Enabling GitHub Pages to publish your site from To select master
or gh-pages
as your publishing source, you must have the branch present in your repository. If you don't have a master
or gh-pages
branch, you can create them and then return to source settings to change your publishing source.
- On GitHub Enterprise, navigate to your GitHub Pages site's repository.
Under your repository name, click Settings.
Use the Select source drop-down menu to select master or gh-pages as your GitHub Pages publishing source.
- Click Save.
/docs
folder on your master
branch
Publishing your GitHub Pages site from a 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
.
Tip: If you remove the /docs
folder from the master
branch after it's enabled, your site won't build and you'll get a page build error message for a missing /docs
folder.
- On GitHub Enterprise, 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.