Skip to main content

A CLI tool to securely sync .env files across teams using encryption and GitHub Gists.

Project description

EnvSync

EnvSync is a lightweight CLI tool that securely synchronizes .env environment variables across development teams.

Instead of sharing .env files through chat, email, or manually copying environment variables, EnvSync encrypts the environment variables and stores them in a private GitHub Gist. Team members can then securely pull the encrypted secrets and restore them locally.

This helps prevent one of the most common developer issues:

"It works on my machine."


Features

  • Secure AES encryption for environment variables
  • Sync secrets through GitHub Gist
  • Simple CLI workflow
  • Automatic configuration storage
  • Lightweight developer tool
  • Easy team collaboration

How It Works

EnvSync encrypts your .env file before syncing it.

.env
  ↓
Read variables
  ↓
Encrypt (AES)
  ↓
Upload to GitHub Gist
  ↓
Teammates pull
  ↓
Decrypt
  ↓
Restore .env

Installation

Clone the repository:

git clone https://github.com/YOUR_USERNAME/env-sync.git
cd env-sync

Create a virtual environment:

python -m venv venv

Activate the environment.

Windows:

venv\Scripts\activate

Linux / macOS:

source venv/bin/activate

Install dependencies:

pip install -r requirements.txt

Install the CLI tool locally:

pip install -e .

You can now use the envsync command in your terminal.


Requirements

  • Python 3.8+
  • GitHub account
  • GitHub Personal Access Token with gist permission

First-Time Setup

Before using EnvSync, you need a GitHub Personal Access Token.

Generate a GitHub Token

  1. Go to:
https://github.com/settings/tokens
  1. Click Generate new token (classic)
  2. Give it a name like:
envsync-cli
  1. Select the permission:
gist
  1. Generate the token and copy it.

Example token:

ghp_xxxxxxxxxxxxxxxxx

Usage

1. Create a .env file

Example:

API_KEY=123456
DB_PASSWORD=mysecret
PORT=5000

First Developer Setup

The first developer creates the shared secret store.

envsync push

The CLI will ask for the GitHub token.

EnvSync will then:

  • Read the .env file
  • Encrypt the environment variables
  • Create a private GitHub Gist
  • Save local configuration

Example output:

✔ New secret store created

Share this with teammates:

envsync init --gist abcd1234 --key XyZ987

Teammate Setup

Teammates initialize EnvSync using the shared credentials.

envsync init --gist abcd1234 --key XyZ987

This creates a local configuration file:

.envsync/config.json

Pull Environment Variables

To download the shared environment variables:

envsync pull

This will:

  • Download encrypted secrets
  • Decrypt them
  • Recreate the .env file locally

Example output:

.env restored successfully

Updating Secrets

When environment variables change, run:

envsync push

This will update the encrypted secrets stored in the GitHub Gist.


Example Team Workflow

Team leader:

envsync push

Teammate:

envsync init --gist <gist_id> --key <encryption_key>
envsync pull

Now both machines share identical .env variables.


Project Structure

env-sync
│
├── envsync
│   ├── cli.py
│   ├── config.py
│   ├── crypto.py
│   ├── env_parser.py
│   └── gist_api.py
│
├── .envsync
│   └── config.json
│
├── .env
├── requirements.txt
├── setup.py
└── README.md

Security Notes

  • .env files are encrypted before uploading
  • Only users with the encryption key can decrypt the secrets
  • .envsync/config.json is excluded from Git
  • Never commit your .env file to a repository

Recommended .gitignore entries:

venv/
__pycache__/
.env
.envsync/
*.pyc

Future Improvements

  • Token login command (envsync login)
  • .env.example generator
  • Environment validation
  • Team role management
  • Docker integration

License

MIT License


Author

Sreehari S Kumar

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

envsync0o2-0.1.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

envsync0o2-0.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file envsync0o2-0.1.0.tar.gz.

File metadata

  • Download URL: envsync0o2-0.1.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for envsync0o2-0.1.0.tar.gz
Algorithm Hash digest
SHA256 473f5ddedb2e0b52a640d0aab3ec96718e6b4b69c08ce23bef0c370b5557e79c
MD5 3576ef301319fddc5499c595716ed6ee
BLAKE2b-256 e7297cce59dbdb3f9b85c9d9c6d0c8242e36ef49395e92a42d5086f6360f5561

See more details on using hashes here.

File details

Details for the file envsync0o2-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: envsync0o2-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for envsync0o2-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7add791b4ea3f9fdb925d376cb9699abd9a0ff94f57335a2e91c0c28138d3ac3
MD5 e2d0bcb76fb5aa8c0d915e976140dda7
BLAKE2b-256 14c90ad1312489bf4fe8a2216885fde85cbee2181fa10b0455bd5f3c0887c9d0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page