The vercel pull command is capable of retrieving project-specific information when the VERCEL_PROJECT_ID environment variable is set. However, Vercel users are not informed about this functionality. Running vercel pull --help, there's no information about this:
Toggle to see command output
Vercel CLI 41.4.1
▲ vercel pull [project-path] [options]
Pull latest environment variables and project settings from Vercel.
Options:
--environment Deployment environment [development] --git-branch Specify the Git branch to pull specific Environment Variables for -y, --yes Skip questions when setting up new project using default scope and settings
Global Options:
--cwd Sets the current working directory for a single run of a command -d, --debug Debug mode (default off)
-Q, --global-config Path to the global .vercel directory
-h, --help Output usage information
-A, --local-config Path to the local vercel.json file
--no-color No color mode (default off)
-S, --scope Set a custom scope
-t, --token Login token
-v, --version Output the version number
Examples:
-
Pull the latest Environment Variables and Project Settings from the cloud
$ vercel pull
-
Pull the latest Environment Variables and Project Settings from the cloud targeting a directory
$ vercel pull ./path-to-project
-
Pull for a specific environment
$ vercel pull --environment=
-
Pull for a preview feature branch
$ vercel pull --environment=preview --git-branch=feature-branch
-
If you want to download environment variables to a specific file, use
vercel env pullinstead$ vercel env pull
As you can see, there's no guidance about VERCEL_PROJECT_ID.
I also think that a --project flag might be helpful. When this flag is set, it overrides the environment variable.