This script automates the installation, uninstallation, cleanup, and updating of pre-commit hooks in your Git repositories.
Pre-commit hooks help ensure that your commits meet certain standards and protect against secret leakages.
- Python must be installed on your system.
You can download and run the script directly using curl. Execute the following command in your terminal:
curl -fsSL https://raw.githubusercontent.com/Andygol/check-leaks/main/pre-commit.sh | sh -s install
This will download and run the script with the install
command.
Alternatively, you can download the script and make it executable manually:
curl -O https://raw.githubusercontent.com/Andygol/check-leaks/main/pre-commit.sh
chmod +x pre-commit.sh
Run the following command to set up pre-commit hooks for your repository:
./pre-commit.sh install
This will create a virtual environment, install pre-commit, configure hooks including one for detecting secrets, and run pre-commit.
To remove pre-commit from your repository, use the following command:
./pre-commit.sh uninstall
This will uninstall pre-commit and leave your repository without any hooks.
If you want to remove the virtual environment and configuration files, run:
./pre-commit.sh cleanup
Do note that this will not remove the hooks from your repository. Use the uninstall
command to remove them. You can combine uninstall
and cleanup
to remove the hooks and the virtual environment.
./pre-commit.sh uninstall cleanup
curl -fsSL https://raw.githubusercontent.com/Andygol/check-leaks/main/pre-commit.sh | sh -s uninstall cleanup
To update your pre-commit hooks to the latest versions, use:
./pre-commit.sh update
This will automatically update the hooks using pre-commit autoupdate
.
- This script assumes that you have Python installed on your system.
- For more details on pre-commit, visit the official documentation.
Feel free to customize the script based on your needs.
Note: Always review scripts before running them, and use them at your own risk.
This script is licensed under the MIT License. See the LICENSE file for details.
This script was created by Andrii Holovin (Andygol).