
😎 Gitleaks for Vibe Coders
Stop leaking API keys on GitHub. Learn how to use Gitleaks with pre-commit hooks on macOS and Windows to catch secrets before they go public.
· 1 min read
When you're just starting your coding journey, there's so much to learn. Security often takes a backseat while you're figuring out how to make things work with tools like Windsurf and Cursor. That's totally normal!
One common challenge new coders face is managing sensitive information like API keys. It's easy to include these directly in your code when you're learning, but this can lead to unexpected issues if that code gets pushed to GitHub.
This is where Gitleaks comes in --- it's a simple tool that helps catch things like API keys and passwords before they end up in your public repositories.
How it helps you
Gitleaks scans your code for anything that looks like private credentials. It runs right before your code gets committed, giving you a heads-up if it spots something that probably shouldn't be shared.
Setting it up
On Mac:
brew install gitleaks
On Windows:
choco install gitleaks
To make it run automatically whenever you commit code, you'll want to set up something called a pre-commit hook:
-
Run
pip install pre-commit -
Create a file called
.pre-commit-config.yamlin your project folder with:
repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.16.1
hooks:
- id: gitleaks
-
Run
pre-commit installin your project folder
What happens next
Now you're all set! When you're working on projects with Cursor's AI assistance or building interfaces with Windsurf, Gitleaks will quietly help keep your private information private.
It's a small step that can save you from headaches down the road as you continue your coding journey. Everyone's learning as they go, and tools like this make the process smoother.
If you want to learn more, check out the Gitleaks GitHub page or try their online playground where you can test it without installing anything.