Deploying to Vercel with Vercel CLI

Learn how to create Deployments on Vercel using Git, Vercel CLI, Deploy Hooks, and Vercel REST API.
Table of Contents

Vercel CLI allows you to deploy your Projects directly from the Command Line Interface (CLI). You can use this deployment method whether your project is connected to a Git repository or not.

For a new Project, the first deploy will ask to link your local directory to the Vercel Project. This is done by running the vercel command in your local project directory:

Terminal
vercel

Making an initial deployment with the vercel command.

Upon creating the first Deployment for a Project, the vercel command creates a Production Deployment.

After running this command, a .vercel directory is added at the root of your project folder. It contains both the organization and project ID. Vercel CLI automatically detects the framework your project is using.

After the initial step, you can run the vercel command again to create a Preview Deployment. To create a Production Deployment, use the vercel --prod command:

Terminal
vercel --prod

Making a Production Deployment with the vercel command.

You can use the Vercel CLI to create custom CI/CD workflows and integrate into your existing pipelines.

Further, when using vercel build and vercel deploy --prebuilt, you can prevent giving access to source code by only uploading the generated build outputs to Vercel.

See the Vercel CLI documentation for other configuration options and more information.

Last updated on September 11, 2024