pre-commit hook script with automatic installation of gitleaks and checks for sensitive information π
β¨ Security Pre-commit Auto Script β¨
This repository contains the pre-commit-auto-script
, a script that helps automate the installation and configuration of pre-commit
hooks in your Git repository. It utilizes gitleaks to enhance the security of your codebase. π
This repository contains the pre-commit-auto-script
, a script that helps automate the installation and configuration of pre-commit
hooks in your Git repository. It utilizes gitleaks to enhance the security of your codebase.
Before using this script, make sure you have the following dependencies installed:
- Git βοΈ
- Curl βοΈ
To install the script, simply run the following command in your terminal:
curl -sSfL https://raw.githubusercontent.com/ruslanlap/pre-commit-auto-script/main/install.sh | bash
β Enable:
source on-off-gitleaks.sh; enable
β Disable:
source on-off-gitleaks.sh; disable
After running the installation command, it will automatically install and configure pre-commit
hooks for your Git repository. It also integrates gitleaks
to scan for sensitive information in your codebase and prevent leaks. π‘οΈ
You can review and customize the list of available hooks in the .pre-commit-config.yaml
file, which will be created in the root directory of your project. For example, you can add more arguments to the .gitleaks.toml
file.
Wondering how the script works? Take a look at this demo:
This Bash script automates the process of scanning a Git repository for sensitive information using Gitleaks.
- Ensure Git and Gitleaks are installed and accessible in your environment.
- Run the script and enter the Git repository URL when prompted.
- Monitor the script's output for scan results and follow any actionable items indicated.
- Clones a repository from a specified URL into a local directory for scanning.
- Runs Gitleaks to detect potential leaks (such as passwords, API keys, etc.) within the cloned repository.
- Provides color-coded feedback throughout the process using ASCII art, emojis, and formatted messages.
- Optionally cleans up temporary files after scanning.
To quickly install and use this script, run the following command:
curl -sSfL https://raw.githubusercontent.com/ruslanlap/pre-commit-auto-script/main/gitleaks_on_clone && chmod +x gitleaks_on_clone && ./gitleaks_on_clone
π Stay secure with pre-commit-auto-script
and gitleaks
! Happy coding! π
MIT