Note: Enabling and disabling Pages in the Pages API is currently available for developers to preview. See the blog post preview for more details. To access the new endpoints during the preview period, you must provide a custom media type in the Accept header:
application/vnd.github.switcheroo-preview+json
Warning: The API may change without advance notice during the preview period. Preview features are not supported for production use. If you experience any issues, contact GitHub Support or GitHub Premium Support.
POST /repos/:owner/:repo/pages
| Name | Type | Description |
|---|---|---|
source[branch] |
string |
The repository branch used to publish your site's source files. Can be either master or gh-pages. |
source[path] |
string |
The repository directory that includes the source files for the Pages site. When branch is master, you can change path to /docs. When branch is gh-pages, you are unable to specify a path other than /. |
{
"source": {
"branch": "master",
"path": "/docs"
}
}
Status: 201 Created
{
"url": "https://api.github.com/repos/github/developer.github.com/pages",
"status": "built",
"cname": "developer.github.com",
"custom_404": false,
"html_url": "https://developer.github.com",
"source": {
"branch": "master",
"directory": "/"
}
}