Skip to content
Latchkey

netlify deploy --prod: Deploy from CI

netlify deploy uploads a directory as a draft deploy; netlify deploy --prod publishes it to the production URL.

The Netlify CLI deploys a prebuilt directory. In CI you point it at the build output, pass the site ID and an auth token, and add --prod to go live.

What it does

netlify deploy uploads the contents of --dir as a draft deploy and returns a unique preview URL. Adding --prod publishes the same files to the production domain. Functions in the functions directory are deployed alongside the static files.

Common usage

Terminal
netlify deploy --prod --dir=dist --site "$NETLIFY_SITE_ID" --auth "$NETLIFY_AUTH_TOKEN"
# build via netlify.toml first, then deploy
netlify build
netlify deploy --prod --dir=dist --site "$NETLIFY_SITE_ID" --auth "$NETLIFY_AUTH_TOKEN"

Options

FlagWhat it does
--prodDeploy to the production URL instead of a draft
--dir <path>Folder to publish (the build output)
--site <id>Target site API ID (or use NETLIFY_SITE_ID)
--auth <token>Personal access token (or NETLIFY_AUTH_TOKEN)
--functions <dir>Directory of serverless functions to deploy
--message <m>Deploy log message

In CI

Set NETLIFY_AUTH_TOKEN and NETLIFY_SITE_ID as env vars; the CLI reads both automatically, so you can drop --auth and --site from the command. There is no confirmation prompt on deploy, but auth and site must be resolvable or it exits non-zero.

Common errors in CI

"Error: Not authorized to deploy. Please set the NETLIFY_AUTH_TOKEN environment variable" means no token. "Error: No site id specified" means neither --site nor NETLIFY_SITE_ID is set. "Error: Deploy directory 'dist' does not exist" means the build did not run or --dir is wrong.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →