Skip to content

See what shipped at NTL DEPLOY. Try the new AI workflow →

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.

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 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.

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.

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.

You can connect Netlify sites to repositories on Bitbucket Data Center and Server instances. Learn about Netlify’s Bitbucket Data Center and Server 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.)

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:

  1. From your project dashboard, go to Project configuration Build & deploy Continuous deployment Enforce deployment methods.
  2. 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.

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.