Deploy Center Docs Guides GitHub Download

Netlify

Last updated · Edit on GitHub

On this page

Netlify is off by default. Turn it on with:

deploys providers enable netlify

Why it is worth it#

Since September 2025 Netlify bills in credits, and every production deploy costs 15 of them. When every push to the production branch builds, a busy day can cost more than a whole month of deploying once a day by hand.

How it works#

Netlify has no API switch for "do not build on push" that still lets you deploy. build_settings.stop_builds ("Stop builds" in the UI) also blocks builds from the API and from build hooks, so Deploy Center does not use it.

What it does instead:

  1. A build hook. autodeploy-off creates a build hook named deploy-center on the site, or reuses one that already exists. Its URL is kept in ~/.config/deploys/netlify-hooks.json (mode 0600). Anyone who has that URL can start a build, so it is never printed.
  2. An ignore rule in your repo. Before every build Netlify runs the ignore command and skips the build when the command exits 0. Netlify sets INCOMING_HOOK_TITLE only for builds a build hook started (docs), so this rule skips everything else:
    [build]
      ignore = "[ -z \"$INCOMING_HOOK_TITLE\" ]"
  3. Deploying posts to the hook. Deploy Center then reads the site's deploy list until a deploy shows up that was not there before the call. That deploy is the one it follows.

Setup#

  1. Create a personal access token at app.netlify.com > User settings > Applications > Personal access tokens. Then store it. It is checked against Netlify before it is saved:

    pbpaste | deploys netlify set-key

    You can also set NETLIFY_AUTH_TOKEN in the environment instead, for CI or a server. The environment wins over the keychain (service deploy-center-netlify).

  2. Turn auto-deploy off for a site. This creates the hook and prints the netlify.toml step:
    deploys netlify autodeploy-off <site>
  3. Add the ignore line to netlify.toml and merge it to the production branch. If the site has a base directory, the file goes there. If the file already has a [build] section, add only the ignore line to it.
  4. Run autodeploy-off again. It reads the file through gh and, once it finds the rule, marks the site as deployable. Until then deploys netlify deploy <site> refuses: without the rule, every push would still build.

    If your repo is not on GitHub, or gh cannot read it, check the file yourself and record it by hand:

    deploys netlify autodeploy-off <site> --rule-added

Deploy Center also looks again on its own: deploys netlify list re-checks every site that has a hook but no confirmed rule, unless DEPLOYS_NO_GITHUB is set.

What you can and cannot do#

Deployyes, always the newest commit of the production branch
Deploy a given commit (--sha)no: a build hook cannot choose a commit
Preview deploys from hereno
Cancel a deployyes
Roll backyes: restores the ready production deploy before the live one. A restore does not build, so it costs no build credits.
Build logno: Netlify's REST API does not give it. deploys logs shows the state, the error message and a link to the log in the dashboard.

Builds that the rule skipped show up at Netlify as canceled ("no content change"). Deploy Center leaves them out when it shows the last deploy.

Trade-offs#

Undo#

  1. Remove the ignore line from netlify.toml, or change it back to your earlier one, and merge. From then on every push builds again.
  2. Optionally delete the deploy-center build hook in Site configuration > Build & deploy > Build hooks, and remove the site from ~/.config/deploys/netlify-hooks.json.
  3. To remove the token: security delete-generic-password -s deploy-center-netlify.
  4. deploys providers disable netlify hides Netlify again.