git-vars package

Pulling Variables to Local

< >

Pulling Variables to Local .env.project

Export all environment variables from a GitLab repository to your local environment.

Prerequisites

Ensure you are in the base directory of your repository. This is important because the .env file will be stored there.

cd /path/to/your/repository

Using Command Option

git-vars pull -s project -f .env.project

# -s --scope (Optional): Need to choose one from 'project', 'group' or 'instance'. Default: The one provided in the `.git-vars` configuration file.
# -f --file: Output file where the variables are going to be exported. Default: .env

You can check that the .env.project file has been created or updated. Type cat .env.project on your terminal to display the environment variables stored in the file .env.project. The output should be something like this:

TEST=abc123
AWS_ACCESS_KEY_ID=aaaaaaaaaa
AWS_DEFAULT_REGION=eu-central-1
AWS_SECRET_ACCESS_KEY=1234567890

Where the variables follow the format KEY=VALUE.