Git workflows overview
Git can be at the core of Netlify’s workflow. When you push changes to your site’s Git repository, Netlify detects your changes and triggers automated deploys, functions, and more across our global CDN.
Git and Netlify
Section titled “Git and Netlify”Netlify builds on Git to optimize the developer workflow and improve productivity.
For example, you can configure continuous deployment with Netlify so that every git push
from your local Git repository triggers a new Deploy Preview.
You can also keep your Git-centric workflow on the command line with the Netlify CLI. Learn more about Netlify CLI or explore how to create a site from a template using Netlify CLI.
To learn more about how Netlify optimizes development around the Git workflow, check out this blog post on Netlify’s Git-centric workflow.
Git provider support
Section titled “Git provider support”Git providers offer hosting for Git repositories. Using the Netlify UI, you can connect your site’s repository to Netlify from these Git providers:
- GitHub
- GitLab
- Bitbucket
- Azure DevOps
For set up guidance and repository permissions requirements that are more specific for each Git provider, check out our docs on repository permissions and linking.
For general guidance on how to set up your site with Netlify from a Git repository, check out how to add a new site. You can also start a site or app from Netlify templates. As you set up your site, you can configure build settings as needed, such as your build command and the directory in your repository to deploy.
GitHub Enterprise Server support
Section titled “GitHub Enterprise Server support”You can connect Netlify sites to GitHub Enterprise Server repositories that are available at a public URL. Learn more about Netlify’s GitHub Enterprise Server support.
GitLab self-managed support
Section titled “GitLab self-managed support”You can connect Netlify sites to GitLab self-managed repositories that are available at a public URL. Learn about Netlify’s GitLab self-managed support.
Bitbucket Data Center and Server support
Section titled “Bitbucket Data Center and Server support”You can connect Netlify sites to repositories on Bitbucket Data Center and Server instances. Learn about Netlify’s Bitbucket Data Center and Server support.
Git repository support
Section titled “Git repository support”Netlify supports building your site from different types of Git repositories.
- private or public repositories owned by personal user accounts
- public repositories owned by an organization account
- private repositories owned by an organization account (This feature is available on Core Pro and Enterprise plans, depending on Git provider.)
- monorepos
- repositories accessed during a build, such as submodules or npm package repositories
- repositories available at a public URL from GitHub Enterprise Server or GitLab self-managed (This feature is available on Enterprise plans.)
- repositories available at a private or public URL from Bitbucket Data Center and Server (This feature is available on Enterprise plans.)
Enforce Git-based deployments
Section titled “Enforce Git-based deployments”Require Git-based workflows to publish to production.
If your Netlify project is linked (or connected) to a Git repository with a supported Git provider, then you can require that all production deploys are triggered by a Git push to your repository’s production branch.
This setting ensures that people or AI agents cannot accidentally deploy to your production branch through the Netlify CLI, MCP server, or API.
By default, this setting is off, allowing developers to deploy to any deployment context (including production) using the Netlify CLI, MCP server, API, and Git workflows.
To enable this setting you must have a Developer or Team Owner role.
Once enabled, this setting ensures the following:
- Only way to publish to production deployment context is through a Git workflow, which pushes changes to your project’s production branch, which you can define through Netlify (Learn more about setting your production branch).
- You or an AI agent can still use the Netlify CLI, MCP server, or API to deploy to other deploy contexts (such as for branch deploys and Deploy Previews)
- You cannot directly publish a Deploy Preview to production from the Netlify UI anymore. Instead, to publish changes from a Deploy Preview, you must merge a pull/merge request to the production branch.
To enforce Git-based deployments:
- From your project dashboard, go to Project configuration . Build & deploy Continuous deployment Enforce deployment methods
- Select Configure, then choose your setup option and confirm.
You can turn off this setting at any time as well. When you turn on or off this setting, your Netlify team’s audit log is updated.
Git support limitations
Section titled “Git support limitations”Netlify does not support client-side Git hooks and will not run Git hooks from your main Git repository or submodule. Learn more about Git hooks.
More Git resources
Section titled “More Git resources”Did you find this doc useful?
Your feedback helps us improve our docs.