@sosthene14/gg
v1.1.0
Published
Automatic protection against common Git mistakes (pushed .env, exposed secrets, tracked node_modules, large files).
Maintainers
Readme
@sosthene14/gg
Automatic protection against common Git mistakes — TypeScript/Node.js CLI.
Installation
npm install -g @sosthene14/ggQuick Start
For new projects
cd your-project
gg init # Creates .gitignore and cleans staged files if neededEnable global protection
gg install # Protects all your git repositoriesCommands
| Command | Description |
|---|---|
| gg init | Initialize current repo (create .gitignore, clean staged files) |
| gg install | Enable global protection for all repos |
| gg uninstall | Disable global hooks |
| gg scan | Scan current repository |
| gg fix | Scan and auto-fix issues |
| gg config | Show configuration |
| gg config set <key> <value> | Update setting (maxFileSizeMB, blockFileSizeMB, enabled) |
| gg update | Refresh hooks |
What it detects
- ❌
.envfiles pushed to git - ❌ Secrets in code (API keys, tokens, passwords)
- ❌ Generated folders (
node_modules,dist, etc.) - ❌ Large files (configurable thresholds)
- ❌ Sensitive files (private keys, certificates)
Hook behavior
- pre-commit: Auto-fixes
.envand generated folders by removing them from index and updating.gitignore. Blocks commit only for secrets or large files beyond threshold. - pre-push: Re-checks commits about to be pushed. Blocks if issues remain.
Supported languages
Automatically detects and creates appropriate .gitignore for:
Node.js • Go • Python • Rust • Ruby • PHP • Java • C#/.NET • C/C++ • Swift • Kotlin • Dart/Flutter • Elixir • Scala • Clojure • Haskell • R • Julia • Lua • Perl • Zig • Nim • Crystal • OCaml • F# • Erlang • Groovy
Configuration
gg config set maxFileSizeMB 10 # Warn threshold
gg config set blockFileSizeMB 50 # Block threshold
gg config set enabled true # Enable/disableConfig stored in ~/.gitguard/config.json
License
MIT
