{"id":21471560,"url":"https://github.com/nrjdalal/commitsafe","last_synced_at":"2026-02-27T15:09:30.113Z","repository":{"id":249923525,"uuid":"832965238","full_name":"nrjdalal/commitsafe","owner":"nrjdalal","description":"A powerful CLI tool that encrypts and decrypts .env files to protect your sensitive information during git commits. CommitSafe ensures that secrets remain secure and reduces the risk of accidental exposure in your repositories.","archived":false,"fork":false,"pushed_at":"2024-11-27T04:54:16.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T23:48:19.645Z","etag":null,"topics":["ci-cd","cli","commitsafe","crypto","decrypt","decryption","devops","dotenv","encrypt","encryption","env","environment-variables","file-safety","git-hooks","secrets","secure","security"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/commitsafe","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nrjdalal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-24T05:08:25.000Z","updated_at":"2024-11-27T04:54:19.000Z","dependencies_parsed_at":"2024-07-24T06:46:18.814Z","dependency_job_id":"755553a5-d67a-487d-b6ea-7ce72f0e7f8d","html_url":"https://github.com/nrjdalal/commitsafe","commit_stats":null,"previous_names":["nrjdalal/encrypthor","nrjdalal/enveil"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/nrjdalal/commitsafe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrjdalal%2Fcommitsafe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrjdalal%2Fcommitsafe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrjdalal%2Fcommitsafe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrjdalal%2Fcommitsafe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nrjdalal","download_url":"https://codeload.github.com/nrjdalal/commitsafe/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrjdalal%2Fcommitsafe/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29901364,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T14:46:13.553Z","status":"ssl_error","status_checked_at":"2026-02-27T14:46:10.522Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ci-cd","cli","commitsafe","crypto","decrypt","decryption","devops","dotenv","encrypt","encryption","env","environment-variables","file-safety","git-hooks","secrets","secure","security"],"created_at":"2024-11-23T09:36:40.410Z","updated_at":"2026-02-27T15:09:30.099Z","avatar_url":"https://github.com/nrjdalal.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# commitsafe\n\n\u003e A powerful CLI tool that encrypts and decrypts .env files to protect your sensitive information during git commits. CommitSafe ensures that secrets remain secure and reduces the risk of accidental exposure in your repositories.\n\n![npm version](https://img.shields.io/npm/v/commitsafe)\n![license](https://img.shields.io/npm/l/commitsafe)\n![downloads](https://img.shields.io/npm/dt/commitsafe)\n\n- **NPM Package:** [commitsafe](https://www.npmjs.com/package/commitsafe)\n- **GitHub Repository:** [nrjdalal/commitsafe](https://github.com/nrjdalal/commitsafe)\n\n## What's New in Version 2.3.0?\n\n- Enhanced Git hooks integration for seamless operation.\n- Transitioned encryption/decryption backend from `npm:crypto-js` to the efficient `node:crypto` module.\n\n## Installation\n\nYou can install `commitsafe` using either npm or bun:\n\n```bash\n# Using npm\nnpm install --save-dev commitsafe\n```\n\n```bash\n# Using bun\nbun add --dev commitsafe\n```\n\n## Usage\n\n`commitsafe` enables encryption and decryption of environment variables within files. Run `commitsafe --help` for command-line interface details:\n\n```\nUsage: commitsafe [options] \u003cfiles...\u003e\n\nEncrypt and decrypt environment variables in a file.\n\nArguments:\n  \u003cfiles...\u003e       Files to encrypt or decrypt\n\nOptions:\n  -l, --list       List files and their corresponding encryption keys\n  -e, --encrypt    Encrypt environment variables in a file\n  -d, --decrypt    Decrypt environment variables in a file\n  -k, --key \u003ckey\u003e  Optional: Specify the encryption/decryption key. By default, commitsafe uses keys stored in ~/.commitsafe\n  -h, --help       Display help for command\n```\n\n## How It Works\n\n- Encrypts specified environment variables in `.env` files.\n- Securely decrypts the variables back when needed.\n\nExample:\n\n```env\n# Original .env file\nHELLO=world\n\n# After running `commitsafe -e .env`\nHELLO=encrypted::8cwf0HbsXjaniUiCZ4EH+A==:7XMi+FfjoKu3b+q/lRNuwQ==\n\n# After running `commitsafe -d .env`\nHELLO=world\n```\n\n## Instructions\n\n### Encrypting/Decrypting a Single File\n\n```bash\n# Encrypt a single .env file\ncommitsafe -e .env\n\n# Decrypt a single .env file\ncommitsafe -d .env\n```\n\n### Encrypting/Decrypting Multiple Files\n\n```bash\n# Encrypt multiple .env files\ncommitsafe -e .env .env.local ...\n\n# Decrypt multiple .env files\ncommitsafe -d .env .env.local ...\n```\n\n### Using a Specific Key (Ideal for CI/CD Environments)\n\n```bash\n# Encrypt using a specific key\ncommitsafe -e .env -k my-secret-key\n\n# Decrypt using a specific key\ncommitsafe -d .env -k my-secret-key\n```\n\n### Listing Files and Their Encryption Keys\n\n```bash\ncommitsafe -l .env .env.local ...\n```\n\n## Best Practices: Committing `.env` Files Safely\n\nTo automate the safe management of `.env` files using Git hooks, follow these steps:\n\n1. **Install necessary development dependencies:**\n\n   ```bash\n   bun add -D commitsafe lint-staged simple-git-hooks\n   ```\n\n2. **Encrypt your `.env` file initially to set up an encryption key:**\n\n   ```bash\n   commitsafe -e .env\n   ```\n\n3. **Configure Git hooks and lint-staged in your `package.json`:**\n\n   Add the following scripts to automate pre-commit encryption and post-commit decryption:\n\n   ```json\n   // In package.json\n   {\n     \"scripts\": {\n       \"prepare\": \"simple-git-hooks\"\n     },\n     \"lint-staged\": {\n       \".env\": [\"commitsafe -e\"]\n     },\n     \"simple-git-hooks\": {\n       \"pre-commit\": \"bunx lint-staged\",\n       \"post-commit\": \"bunx commitsafe -d .env\"\n     }\n   }\n   ```\n\n   Then, apply the hook configuration with:\n\n   ```bash\n   bun run prepare\n   ```\n\n---\n\nBy leveraging `commitsafe`, you can confidently manage your `.env` files by ensuring that sensitive information remains encrypted, reducing the risk of accidental exposure.\n\nFor more details, visit the [GitHub repository](https://github.com/nrjdalal/commitsafe). If you encounter issues, please report them [here](https://github.com/nrjdalal/commitsafe/issues).\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnrjdalal%2Fcommitsafe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnrjdalal%2Fcommitsafe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnrjdalal%2Fcommitsafe/lists"}