LinuxCommandLibrary

netlify

Deploy and manage Netlify websites

TLDR

Log in to the Netlify account

$ netlify login
copy

Deploy the contents of a directory to Netlify
$ netlify deploy
copy

Configure continuous deployment for a new or an existing site
$ netlify init
copy

Start a local dev server
$ netlify dev
copy

SYNOPSIS

netlify [options/flags]

Examples:
netlify deploy [--prod] [--dir=path]
netlify build
netlify login
netlify link
netlify functions:create

PARAMETERS

--help, -h
    Displays help information for the current command or subcommand.

--version, -v
    Shows the version of the Netlify CLI being used.

--json
    Outputs command results in JSON format, useful for scripting.

--debug
    Enables verbose logging for debugging purposes.

--auth <token>
    Specifies an authentication token to use for the command, overriding default methods.

--base <path>
    Defines the base directory for the command to operate within, if different from the project root.

--cwd <path>
    Sets the current working directory for the command execution, if different from the terminal's CWD.

--offline
    Attempts to operate in offline mode, useful for commands that don't require an active internet connection.

DESCRIPTION

The netlify command-line interface (CLI) is a powerful tool that allows developers to interact with the Netlify platform directly from their terminal. Netlify is a leading platform for web development, offering hosting, serverless functions, form handling, and continuous deployment for modern web projects. The netlify CLI simplifies workflows by enabling users to deploy sites, manage DNS, create and test serverless functions, link local projects to existing Netlify sites, build projects, and much more, all without leaving the command line. It's an indispensable tool for teams and individuals leveraging Netlify's ecosystem, particularly for projects built with modern frontend frameworks and static site generators. It streamlines the development and deployment process, making it highly efficient for JAMstack (JavaScript, APIs, Markup) architectures.

CAVEATS

The netlify CLI requires Node.js and npm (or Yarn) for installation and execution. An active Netlify account is necessary to fully utilize its deployment and management features. Most operations, such as deployment, login, and fetching site information, require an active internet connection. It is not a native Linux command; it must be installed separately as a Node.js package.

INSTALLATION

The Netlify CLI is typically installed globally using npm:
npm install -g netlify-cli
Ensure Node.js and npm are installed on your system first.

AUTHENTICATION

Before deploying or managing sites, you need to authenticate your CLI with your Netlify account:
netlify login
This command will open a browser window for authentication and link your CLI to your Netlify account.

KEY SUBCOMMANDS

The netlify command is structured around subcommands, each providing specific functionality. Some frequently used subcommands include:
- netlify deploy: Deploys a site to Netlify.
- netlify build: Builds your project locally, simulating Netlify's build process.
- netlify init: Initializes a new Netlify site or links a local project to an existing one.
- netlify dev: Runs a local development server for your site, including Netlify Functions and proxying.
- netlify functions: Manages serverless functions (e.g., netlify functions:create, netlify functions:serve).
Each subcommand often has its own set of specific flags and options, which are not exhaustively listed under global parameters.

HISTORY

Netlify was founded in 2014 by Mathias Biilmann and Chris Bach, pioneering the concept of "Jamstack" and modern web development workflows. The Netlify CLI was developed to complement their platform, providing developers with a local interface for their services. It has evolved significantly over time, adding support for serverless functions, local development environments, and advanced deployment options, becoming an integral part of the Netlify developer experience for continuous integration and delivery. Its development has mirrored the growth of the Jamstack architecture and the increasing need for streamlined, command-line driven workflows.

SEE ALSO

git(1), npm(1), node(1), curl(1)

Copied to clipboard