Skip to content

Netlify CLI deploy command

Deploy your project to Netlify

Builds your project locally, or on Netlify with –remote, and deploys it to Netlify. Creates a draft deploy by default. Use –prod to deploy directly to your live site.

The deploy command will:

  • Build your project locally (unless –no-build or –remote is specified)
  • Upload static files, functions, and edge functions
  • Process redirects and headers from netlify.toml or _redirects/_headers files
  • Provide deploy and function logs URLs

For detailed configuration options, see the Netlify documentation.

Usage

Terminal window
netlify deploy

Flags

  • alias (string) - Specifies the alias for deployment, the string at the beginning of the deploy subdomain. Useful for creating predictable deployment URLs. Avoid setting an alias string to the same value as a deployed branch. alias doesn’t create a branch deploy and can’t be used in conjunction with the branch subdomain feature. Maximum 37 characters.
  • allow-anonymous (boolean) - If not logged in, deploy anonymously and create a claimable site instead of requiring authentication
  • context (string) - Specify a deploy context for environment variables read during the build (“production”, “deploy-preview”, “branch-deploy”, “dev”) or branch:your-branch where your-branch is the name of a branch (default: dev)
  • created-via (string) - Specify the source of the deploy (e.g., “cli”, “drop”)
  • dir (string) - Specify a folder to deploy
  • env (string) - Set an environment variable for this deploy only. Applies to deployed functions only. Can be specified multiple times.
  • filter (string) - For monorepos, specify the name of the application to run the command in
  • functions (string) - Specify a functions folder to deploy
  • json (boolean) - Output deployment data as JSON
  • message (string) - A short message to include in the deploy log
  • no-build (boolean) - Do not run build command before deploying. Only use this if you have no need for a build or your project has already been built.
  • open (boolean) - Open project after deploy
  • prod-if-unlocked (boolean) - Deploy to production if unlocked, create a draft otherwise
  • debug (boolean) - Print debugging information
  • auth (string) - Netlify auth token - can be used to run this command without logging in
  • prod (boolean) - Deploy to production
  • remote (boolean) - Build your project on Netlify instead of locally. Useful when building with native packages, on devices with limited resources or missing toolchains. Build logs stream in real time and are available on Netlify.
  • secret-env (string) - Set a secret environment variable for this deploy only. Applies to deployed functions only. The value is masked in the Netlify UI and API. Can be specified multiple times.
  • site (string) - A project name or ID to deploy to
  • site-name (string) - Name for a new site. Implies –create-site if the site does not already exist.
  • skip-functions-cache (boolean) - Ignore any functions created as part of a previous build or deploy commands, forcing them to be bundled again as part of the deployment
  • team (string) - Specify team slug when creating a site. Only works with –create-site or –site-name flag.
  • timeout (string) - Timeout to wait for deployment to finish
  • trigger (boolean) - Trigger a new build of your project on Netlify without uploading local files

Examples

Terminal window
netlify deploy
netlify deploy --site my-first-project
netlify deploy --no-build # Deploy without running a build first
netlify deploy --prod
netlify deploy --prod --open
netlify deploy --prod-if-unlocked
netlify deploy --message "A message with an $ENV_VAR"
netlify deploy --auth $NETLIFY_AUTH_TOKEN
netlify deploy --trigger
netlify deploy --remote # Build on Netlify and deploy a draft
netlify deploy --remote --prod
netlify deploy --context deploy-preview
netlify deploy --env "NODE_ENV=production" --env "API_URL=https://api.example.com"
netlify deploy --env "NODE_ENV=production" --secret-env "DATABASE_PASSWORD=$DB_PASSWORD"
netlify deploy --site-name my-new-site --team my-team # Create site and deploy
netlify deploy --allow-anonymous --dir ./public --no-build # Deploy without auth