Idea
What I’m Trying to Do
I have environment variables set up for my production
, preview
, and development
environments. I want to create a single-branch preview that uses the production
values, except for a couple of tweaks.
What I’d Like
I’d like to be able to do this:
vercel env pull production .env.production
vercel env push preview my-branch .env.production
or maybe
cat .env.production > vercel env push preview my-branch
Workaround
I wrote a script that
- downloads the variables from environment A
- for each pair
- deletes the existing env variable from environment/branch B
- writes the new value to environment/branch B
But the script is error-prone. It doesn’t work well for environment variables that come from Vercel itself, including plugins and shared environments.