Shared environment variables
Shared Environment Variables are environment variables that you define at the team-level and can link to multiple projects. When a Shared Environment Variable is updated, the change is applied to all linked projects.
When a project-level and a Shared Environment Variable share the same key and environment, the project-level environment variable always overrides the Shared Environment Variable.
Shared Environment Variables are created on the Team Settings page. To create a new Shared Environment Variable, follow these steps:
- Go to the Vercel dashboard and select your team from the scope selector. Click on the Settings tab and then select Environment Variables from the left navigation.
- Populate the form with your environment variable details or paste or import an
.env
file:- Key: Fill in the key of the environment variable. - Value: Fill in the value of the environment variable. - Environment: Select the Environments where you want to include it. The environment(s) chosen for the Shared Environment Variable is used when linked to a project. - Link to Projects: Select one or more projects in succession to link the new Shared Environment Variable by using the searchable drop-down. You can keep this empty and link to projects later.
- Click Save to save your new Shared Environment Variable.
A Shared Environment Variable is activated once it is linked to at least one project.
You can link an existing Shared Environment Variable to a project either at the project-level or the team-level.
For project-level linking:
- From your dashboard, select the Project you would like to link the Shared Environment Variable to and click the Settings tab.
- Select Environment Variables from the list, and click on the Link Shared Environment Variables tab.
- Select one or more Shared Environment Variables using the search box:
- Click the Link button
-
From your dashboard, click the Settings tab and go to Environment Variables.
-
Scroll down below the Shared Environment Variable creation form.
-
Find the variable you would like to link. You can use the Search box, the Environments drop-down filter and sort by last updated date, name or type to more easily find the variable.
-
Open the context menu for the specific Shared Environment Variable using the vertical ellipsis icon on the right hand side of the row, and click Edit:
-
From the Environment Variable form, you can link additional projects using the Link to Projects field
-
Click Save when you are done
There are two ways to remove a Shared Environment Variable from a project:
- Unlinking: It is disassociated from the selected project(s) but continues to exist at the level of the team
- Deleting: It is permanently removed from the team and disconnected from all projects it was previously linked to.
- From your dashboard, select the project you would like to unlink the Shared Environment Variable from and click the Settings tab.
- Select Environment Variables, and scroll down to the Shared Environment Variables section.
- Open the context menu for the specific shared environment variable you would like to unlink using the vertical ellipsis icon on the right hand side.
- Click Unlink from this Project:
- From your dashboard, click the Settings tab and go to Environment Variables.
- Scroll down below the Environment Variable creation form.
- Find the variable you would like to link. You can use the Search box, the Environments drop-down filter and sort by last updated date, name or type to more easily find the variable.
- Open the context menu for the specific shared environment variable using the vertical ellipsis icon on the right hand side of the row, and click Edit:
- From the Environment Variable form, click the minus icon to unlink existing projects
- When you are done, click the Save button.
- From your dashboard, click the Settings tab and go to Environment Variables.
- Scroll down below the Environment Variable creation form
- Use the context menu on the specific Shared Environment Variable by clicking the vertical ellipsis icon on the right side of the row
- Click the Delete button
This action will remove the Shared Environment Variable from the Vercel Team. It will also unlink the Environment Variable from ALL previously linked projects.
Branch-specific variables are not currently supported with Shared Environment Variables
Was this helpful?