You can connect each Cloudflare Pages project to a GitHub repository, and Cloudflare will automatically deploy your code every time you push a change to a branch.
Beyond automatic deployments, the Cloudflare GitHub integration lets you monitor, manage, and preview deployments directly in GitHub, keeping you informed without leaving your workflow.
Pages defaults to setting your production environment to the branch you first push. If a branch other than the default branch (for example, main) represents your project's production branch, go to Settings > Build > Branch control, select the Production branch dropdown menu, and choose the desired branch.
You can also use preview deployments to preview versions of your project before merging your production branch and deploying to production. Pages allows you to configure which of your preview branches are automatically deployed using branch build controls. To configure this, go to Settings > Build > Branch control and select an option under Preview branch. Use Custom branches to specify branches to include or exclude from automatic preview deployments.
Every time you open a new pull request on your GitHub repository, Cloudflare Pages will create a unique preview URL, which will stay updated as you continue to push new commits to the branch. Note that preview URLs will not be created for pull requests created from forks of your repository. Learn more in Preview Deployments.
Without any configuration required, you can choose to skip a deployment on an ad hoc basis. By adding the [CI Skip], [CI-Skip], [Skip CI], [Skip-CI], or [CF-Pages-Skip] flag as a prefix in your commit message, Pages will omit that deployment. The prefixes are not case sensitive.
If you have one or multiple projects connected to a repository (for example, a monorepo), you can check on the status of each build within GitHub via GitHub check runs ↗︎.
You can view the checks by selecting the status icon next to a commit within your GitHub repository. In the following example, select the green check mark to view the results of the check run.
Check runs will appear like the following in your repository.
If a build skips for any reason (for example, CI Skip, build watch paths, or branch deployment controls), the check run or commit status will not appear.
You can deploy projects to Cloudflare Pages from your company or side project on GitHub using the Cloudflare Workers & Pages GitHub App ↗︎.
To connect a repository, the Cloudflare Workers & Pages app must be installed on the GitHub account or organization that owns it, and you must authorize the app with your own GitHub user. These are separate steps, and they appear on separate tabs in your GitHub settings.
| Install the app | Authorize the app | |
|---|---|---|
| What it does | Gives Cloudflare access to repositories on a GitHub account or organization. | Tells Cloudflare who you are on GitHub, so you only see the accounts and repositories you can access. |
| Who does it | An owner of the GitHub account or organization, or a member with the GitHub App manager role ↗︎. | Each person who connects a repository from Cloudflare, once. |
| Choose repositories | Yes. Select All repositories or Only select repositories. | No. |
| Where to find it on GitHub | Installed GitHub Apps ↗︎. For an organization, select Switch settings context first. | Authorized GitHub Apps ↗︎ |
| How to undo it | Select Configure, then Uninstall. | Select Revoke. |
Cloudflare asks you to authorize the app when needed. To install the app on another GitHub account or organization, select Add GitHub account when you connect a repository.
For more information, refer to About using GitHub Apps ↗︎ in the GitHub documentation.
When you connect a GitHub repository, you only see the GitHub accounts and repositories you can access on GitHub.
The first time you connect a repository, Cloudflare sends you to GitHub to authorize the Cloudflare Workers & Pages app. You need to do this once, even if someone else on your Cloudflare account already connected GitHub. If the app is not installed on any GitHub account you can access, you also install it on your own GitHub account or an organization.
The account list shows your own GitHub account and organizations where you can access at least one repository, if the app is installed on them. GitHub accounts that belong to other users are not listed, even if they have given you access to one of their repositories.
Authorizing the app is separate from installing it. If your own GitHub account or an organization is missing from the list, select Add GitHub account and install the app on it.
Existing repository connections keep building.
To switch GitHub users, revoke the app on the Authorized GitHub Apps page ↗︎ and connect again.
You can deploy projects to Cloudflare Pages from your company or side project on both GitHub and GitLab.
When authorizing Cloudflare Pages to access a GitHub account, you can specify access to your individual account or an organization that you belong to on GitHub. In order to be able to add the Cloudflare Pages installation to that organization, your user account must be an owner or have the appropriate role within the organization (that is, the GitHub Apps Manager role). More information on these roles can be seen on GitHub's documentation ↗︎.
You can remove Cloudflare Pages' access to your GitHub repository or account by going to the Applications page ↗︎ on GitHub (if you are in an organization, select Switch settings context to access your GitHub organization settings). The GitHub App is named Cloudflare Workers and Pages, and it is shared between Workers and Pages projects.
To remove access to an individual GitHub repository, go to Repository access. Select the Only select repositories option, and configure which repositories Cloudflare can access.
To remove Cloudflare Workers and Pages access to your entire GitHub account, go to Uninstall "Cloudflare Workers and Pages", then select Uninstall. Removing access to the Cloudflare Workers and Pages app revokes Cloudflare's access to all repositories from that GitHub account. If you only want to disable automatic builds and deployments, follow the Disable automatic deployments instructions.
Removing access to GitHub disables new builds for Workers and Pages projects connected to those repositories, though your previous deployments continue to be hosted by Cloudflare.
If you see errors where Cloudflare Pages cannot access your Git repository, uninstall and reinstall the Cloudflare Workers and Pages GitHub App.
-
Go to the installation settings page on GitHub:
- Go to Settings > Build for the Pages project and select Manage under Git Repository.
- Alternatively, open the GitHub installations page for an individual account (
https://github.com/settings/installations) or an organization (https://github.com/organizations/<YOUR_ORGANIZATION_NAME>/settings/installations), find Cloudflare Workers and Pages, and select Configure.
-
In the Cloudflare Workers and Pages GitHub App settings page, go to Uninstall "Cloudflare Workers and Pages" and select Uninstall.
-
In the Cloudflare dashboard, go to the Workers & Pages page.
Go to Workers & Pages ↗ -
Select Create application (if prompted), select the link at the bottom of the page to continue to Cloudflare Pages (Get started or Continue to Pages), and select Import an existing Git repository.
-
Select + Add account, choose the GitHub account you want to add, and select Install & Authorize.
-
You will be redirected to the create project page with your GitHub account or organization in the account list.
-
Trigger a new deployment with your previously affected project.