# vercel env

The `vercel env` command is used to manage [Environment Variables](/docs/environment-variables) of a Project, providing functionality to list, add, remove, export, and run commands with environment variables.

To leverage environment variables in local tools (like `next dev` or `gatsby dev`) that want them in a file (like `.env`), run `vercel env pull <file>`. This will export your Project's environment variables to that file. After updating environment variables on Vercel (through the dashboard, `vercel env add`, or `vercel env rm`), you will have to run `vercel env pull <file>` again to get the updated values.

To run a command with environment variables without writing them to a file, use `vercel env run -- <command>`. This fetches the environment variables directly from your linked Vercel project and passes them to the specified command.

### Exporting Development Environment Variables

Some frameworks make use of environment variables during local development through CLI commands like `next dev` or `gatsby dev`. The `vercel env pull` sub-command will export development environment variables to a local `.env` file or a different file of your choice.

```bash filename="terminal"
vercel env pull [file]
```

To override environment variable values temporarily, use:

```bash filename="terminal"
MY_ENV_VAR="temporary value" next dev
```

> **💡 Note:** If you are using [](/docs/cli/build) or [
> ](/docs/cli/dev), you should use [
> ](/docs/cli/pull) instead. Those commands
> operate on a local copy of environment variables and Project settings that are
> saved under , which
> &#x20;provides.

## Usage

```bash filename="terminal"
vercel env ls
```

```bash filename="terminal"
vercel env add
```

```bash filename="terminal"
vercel env rm
```

## Extended Usage

```bash filename="terminal"
vercel env ls [environment]
```

```bash filename="terminal"
vercel env ls [environment] [gitbranch]
```

```bash filename="terminal"
vercel env add [name]
```

```bash filename="terminal"
vercel env add [name] [environment]
```

```bash filename="terminal"
vercel env add [name] [environment] [gitbranch]
```

```bash filename="terminal"
vercel env add [name] [environment] < [file]
```

```bash filename="terminal"
echo [value] | vercel env add [name] [environment]
```

```bash filename="terminal"
vercel env add [name] [environment] [gitbranch] < [file]
```

```bash filename="terminal"
vercel env rm [name] [environment]
```

### Updating Environment Variables

The `vercel env update` sub-command updates the value of an existing environment variable.

```bash filename="terminal"
vercel env update [name]
```

```bash filename="terminal"
vercel env update [name] [environment]
```

```bash filename="terminal"
vercel env update [name] [environment] [gitbranch]
```

```bash filename="terminal"
cat ~/.npmrc | vercel env update NPM_RC preview
```



```bash filename="terminal"
vercel env pull [file]
```

```bash filename="terminal"
vercel env pull --environment=preview
```

```bash filename="terminal"
vercel env pull --environment=preview --git-branch=feature-branch
```

### Running Commands with Environment Variables

The `vercel env run` sub-command runs any command with environment variables from your linked Vercel project, without writing them to a file. This is useful when you want to avoid storing secrets on disk or need a quick way to test with production-like configuration.

```bash filename="terminal"
vercel env run -- <command>
```

```bash filename="terminal"
vercel env run -- next dev
```

```bash filename="terminal"
vercel env run -e preview -- npm test
```



```bash filename="terminal"
vercel env run -e production -- next build
```



```bash filename="terminal"
vercel env run -e preview --git-branch feature-x -- next dev
```

> **💡 Note:** The  separator is required to distinguish between
> flags for  and the command you want to
> run. Flags after  are passed to your command.

#### Options

The following options are available for `vercel env run`:

- `-e, --environment`: Specify the environment to pull variables from. Defaults to `development`. Accepts `development`, `preview`, or `production`.
- `--git-branch`: Specify a Git branch to pull branch-specific Environment Variables.

## Unique Options

These are options that only apply to the `vercel env` command.

### Sensitive

The `--sensitive` option marks an environment variable as sensitive. Sensitive variables have additional security measures and their values are hidden in the dashboard.

```bash filename="terminal"
vercel env add API_TOKEN --sensitive
```

```bash filename="terminal"
vercel env update API_TOKEN --sensitive
```

### Force

The `--force` option overwrites an existing environment variable of the same target without prompting for confirmation.

```bash filename="terminal"
vercel env add API_TOKEN production --force
```

### Yes

The `--yes` option can be used to bypass the confirmation prompt when overwriting an environment file, removing an environment variable, or updating an environment variable.

```bash filename="terminal"
vercel env pull --yes
```

```bash filename="terminal"
vercel env rm [name] --yes
```

```bash filename="terminal"
vercel env update API_TOKEN production --yes
```


--------------------------------------------------------------------------------
title: "vercel git"
description: "Learn how to manage your Git provider connections using the vercel git CLI command."
last_updated: "2026-02-03T02:58:38.066Z"
source: "https://vercel.com/docs/cli/git"
--------------------------------------------------------------------------------