Gitleaks
Tool manual · Kali & common usage
Cloud · Beginner · Cloud lane
What is Gitleaks?
Gitleaks finds hardcoded secrets in git repos and filesystems.
Prevent credential leaks before push/CI.
Official website: Gitleaks · Documentation
When do you use it?
- You need Scan git repos for leaked secrets.
- You are following a CYNARKS lab or authorized engagement that calls for Gitleaks.
- You already tried simpler checks and need this tool’s deeper capability.
Who uses it?
- Cloud security engineers
- DevSecOps
- Platform / SRE security
How do you use it? (typical flow)
- Install Gitleaks using the steps below (prefer Kali package or official installer).
- Confirm you have authorization for the target (lab VM, own system, or written scope).
- Run --help / man (or the Help section) to see current flags for your version.
- Start with a safe example from Basic commands against localhost or an authorized lab target.
- Record what you ran, what you observed, and any follow-up (filter, report, remediation).
Help & manual (like man / --help)
Every serious tool has a built-in way to look up flags. Learn these first so you are not stuck memorizing every option.
1. Help
gitleaks help
2. Repo
https://github.com/gitleaks/gitleaks
Kali Linux
go install / binary — run on clones of your repos.
1. Installation
| OS | Installation |
|---|---|
Kali Linux | go install / binary — run on clones of your repos. |
All | https://github.com/gitleaks/gitleaks#installing |
2. Basic commands
1. Scan local repo
gitleaks detect --source .
Scan local repo
2. Show help
gitleaks --help
List flags for your installed version (same habit as man/--help).
3. Short help
gitleaks -h
Alternate help flag when supported.
4. Scan filesystem
--no-git
Scan filesystem
Options / flags
| Option | Purpose |
|---|---|
--no-git | Scan filesystem |
5. Useful features
- Pre-commit hooks
- CI scans
6. Practical examples
Example 1: Scan local repo
gitleaks detect --source .
Scan local repo
Example 2: Show help
gitleaks --help
List flags for your installed version (same habit as man/--help).
Example 3: Short help
gitleaks -h
Alternate help flag when supported.
Example 4: Scan filesystem
--no-git
Scan filesystem
7. Important notes
- Find secrets before attackers do.
- Authorized targets only — labs, systems you own, or written permission.
- Prefer reading --help / man / official docs for your installed version; flags change over time.
Related course: cloud security · Commands: /commands#cloud