Gitleaks is a simple security tool that checks your code for exposed secrets and can find passwords, API keys, tokens, and other sensitive information inside files and Git repositories. Gitleaks runs from the command line and works well on Linux and Termux and is useful for checking your projects before sharing or uploading them.
Here’s what you can do with Gitleaks in Termux:
- Scan Git repositories for exposed secrets.
- Scan files and directories for sensitive information.
- Detect API keys, passwords, tokens, and other secrets.
- Create reports in different formats.
- Use custom configuration files.
- Control which detection rules are enabled.
- Hide detected secrets from scan output.
Install Gitleaks in Termux
Below are the commands to install Gitleaks in Termux, just copy and run them one by one in the terminal.
First, update the Termux packages.
pkg update && pkg upgrade -yInstall Git, Go, and Make.
pkg install git golang make -yClone the Gitleaks repository.
git clone https://github.com/gitleaks/gitleaks.gitGo to the Gitleaks directory.
cd gitleaksBuild Gitleaks.
make buildAdd the Gitleaks binary to the Termux PATH.
mv gitleaks $PREFIX/bin/Check the installed Gitleaks version.
gitleaks versionIf the version is displayed, Gitleaks has been installed successfully.
Gitleaks Usage Commands
After installing Gitleaks you can start checking your files and projects for exposed secrets using the useful commands below.
Use gitleaks dir to scan a directory or files for secrets.
gitleaks dir .You can specify a directory:
gitleaks dir /path/to/directoryUse gitleaks git to scan a Git repository.
gitleaks git .You can also scan a Git repository by providing its path:
gitleaks git /path/to/repositoryScan the current directory without using Git history.
gitleaks detect --no-git -vUse gitleaks stdin to scan data provided through the terminal.
echo "example data" | gitleaks stdinUse verbose output to display more information during a scan.
gitleaks dir . -vDisable the Gitleaks banner.
gitleaks dir . --no-bannerDisable colored output.
gitleaks dir . --no-colorSave scan results to a JSON file.
gitleaks dir . -f json -r report.jsonSave scan results as a CSV file.
gitleaks dir . -f csv -r report.csvSave scan results as a SARIF report.
gitleaks dir . -f sarif -r report.sarifUse a custom configuration file.
gitleaks dir . -c .gitleaks.tomlUse a baseline file to ignore previously identified issues.
gitleaks dir . -b baseline.jsonUse a .gitleaksignore file.
gitleaks dir . -i .gitleaksignoreRedact detected secrets from the output.
gitleaks dir . --redactYou can also partially redact detected secrets. For example:
gitleaks dir . --redact=20Show the available commands and options.
gitleaks --helpShow help for a specific command:
gitleaks dir --helpCheck the installed version:
gitleaks versionGitleaks supports several commands:
completion
dir
git
help
stdin
versionThese commands cover the basic Gitleaks options you can use to scan your files and projects for exposed secrets.
End Note
Gitleaks is a useful tool for finding passwords, API keys, tokens and other secrets in your projects and you can use it to check your own files and repositories before sharing them online and remove any sensitive information before publishing your code or project.

