docs/commands/env.md
envControl environment variables for the current project
Usage
netlify env
Flags
filter (string) - For monorepos, specify the name of the application to run the command indebug (boolean) - Print debugging informationauth (string) - Netlify auth token - can be used to run this command without logging in| Subcommand | description |
|---|---|
env:clone | Clone environment variables from one project to another |
env:get | Get resolved value of specified environment variable (includes netlify.toml) |
env:import | Import and set environment variables from .env file |
env:list | Lists resolved environment variables for project (includes netlify.toml) |
env:set | Set value of environment variable |
env:unset | Unset an environment variable which removes it from the UI |
Examples
netlify env:list
netlify env:get VAR_NAME
netlify env:set VAR_NAME value
netlify env:unset VAR_NAME
netlify env:import fileName
netlify env:clone --to <to-project-id>
env:cloneClone environment variables from one project to another
Usage
netlify env:clone
Flags
filter (string) - For monorepos, specify the name of the application to run the command inforce (boolean) - Bypasses prompts & Force the command to run.from (string) - Project ID (From)to (string) - Project ID (To)debug (boolean) - Print debugging informationauth (string) - Netlify auth token - can be used to run this command without logging inExamples
netlify env:clone --to <to-project-id>
netlify env:clone --to <to-project-id> --from <from-project-id>
env:getGet resolved value of specified environment variable (includes netlify.toml)
Usage
netlify env:get
Arguments
Flags
context (string) - Specify a deploy context for environment variables (”production”, ”deploy-preview”, ”branch-deploy”, ”dev”) or branch:your-branch where your-branch is the name of a branchfilter (string) - For monorepos, specify the name of the application to run the command injson (boolean) - Output environment variables as JSONscope (builds | functions | post-processing | runtime | any) - Specify a scopedebug (boolean) - Print debugging informationauth (string) - Netlify auth token - can be used to run this command without logging insite (string) - A project name or ID to targetExamples
netlify env:get MY_VAR # get value for MY_VAR in dev context
netlify env:get MY_VAR --context production
netlify env:get MY_VAR --context branch:feat/make-it-pop # get value in the feat/make-it-pop branch context or branch-deploy context
netlify env:get MY_VAR --scope functions
env:importImport and set environment variables from .env file
Usage
netlify env:import
Arguments
Flags
filter (string) - For monorepos, specify the name of the application to run the command injson (boolean) - Output environment variables as JSONreplace-existing (boolean) - Replace all existing variables instead of merging them with the current onesdebug (boolean) - Print debugging informationauth (string) - Netlify auth token - can be used to run this command without logging insite (string) - A project name or ID to targetenv:listLists resolved environment variables for project (includes netlify.toml)
Usage
netlify env:list
Flags
context (string) - Specify a deploy context for environment variables (”production”, ”deploy-preview”, ”branch-deploy”, ”dev”) or branch:your-branch where your-branch is the name of a branch (default: all contexts)filter (string) - For monorepos, specify the name of the application to run the command injson (boolean) - Output environment variables as JSONplain (boolean) - Output environment variables as plaintextdebug (boolean) - Print debugging informationauth (string) - Netlify auth token - can be used to run this command without logging inscope (builds | functions | post-processing | runtime | any) - Specify a scopesite (string) - A project name or ID to targetExamples
netlify env:list # list variables with values in the dev context and with any scope
netlify env:list --context production
netlify env:list --context branch:feat/make-it-pop # list variables with values in the feat/make-it-pop branch context or branch-deploy context
netlify env:list --scope functions
netlify env:list --plain
env:setSet value of environment variable
Usage
netlify env:set
Arguments
Flags
context (string) - Specify a deploy context for environment variables (”production”, ”deploy-preview”, ”branch-deploy”, ”dev”) or branch:your-branch where your-branch is the name of a branch (default: all contexts)filter (string) - For monorepos, specify the name of the application to run the command inforce (boolean) - Bypasses prompts & Force the command to run.json (boolean) - Output environment variables as JSONscope (builds | functions | post-processing | runtime) - Specify a scope (default: all scopes)debug (boolean) - Print debugging informationauth (string) - Netlify auth token - can be used to run this command without logging insecret (boolean) - Indicate whether the environment variable value can be read again.site (string) - A project name or ID to targetExamples
netlify env:set VAR_NAME value # set in all contexts and scopes
netlify env:set VAR_NAME value --context production
netlify env:set VAR_NAME value --context production deploy-preview # set in the production and deploy-preview contexts
netlify env:set VAR_NAME value --context branch:feat/make-it-pop # set in the feat/make-it-pop branch context
netlify env:set VAR_NAME value --context production --secret
netlify env:set VAR_NAME value --scope builds
netlify env:set VAR_NAME value --scope builds functions
netlify env:set VAR_NAME --secret # convert existing variable to secret
env:unsetUnset an environment variable which removes it from the UI
Usage
netlify env:unset
Arguments
Flags
context (string) - Specify a deploy context for environment variables (”production”, ”deploy-preview”, ”branch-deploy”, ”dev”) or branch:your-branch where your-branch is the name of a branch (default: all contexts)filter (string) - For monorepos, specify the name of the application to run the command inforce (boolean) - Bypasses prompts & Force the command to run.json (boolean) - Output environment variables as JSONdebug (boolean) - Print debugging informationauth (string) - Netlify auth token - can be used to run this command without logging insite (string) - A project name or ID to targetExamples
netlify env:unset VAR_NAME # unset in all contexts
netlify env:unset VAR_NAME --context production
netlify env:unset VAR_NAME --context production deploy-preview
netlify env:unset VAR_NAME --context branch:feat/make-it-pop # unset in the feat/make-it-pop branch context