Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jandre/safe-commit-hook
pre-commit hook for Git that checks for suspicious files.
https://github.com/jandre/safe-commit-hook
Last synced: 14 days ago
JSON representation
pre-commit hook for Git that checks for suspicious files.
- Host: GitHub
- URL: https://github.com/jandre/safe-commit-hook
- Owner: jandre
- License: mit
- Created: 2015-10-01T02:31:48.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-07-13T22:10:55.000Z (over 8 years ago)
- Last Synced: 2025-01-30T21:13:02.401Z (22 days ago)
- Language: Python
- Size: 12.7 KB
- Stars: 328
- Watchers: 13
- Forks: 17
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Safe Commit Hook
This is a git [pre-commit hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) that is inspired by the [Gitrob project](https://github.com/michenriksen/gitrob).
It adds an automatic check to prevent developers from checking in suspicious files (as defined by Gitrob's [signatures.json](https://github.com/michenriksen/gitrob/blob/master/signatures.json))
# Installation
```bash
git clone https://github.com/jandre/safe-commit-hook.git
cd safe-commit-hook
make install
```This will do the following:
* Create a `~/.safe-commit-hook` directory and copy the files from this repo there.
* Create a git alias so you can do `git init-safe-commit` in a project directory, which will create `.git/hooks/pre-commit` (WARNING: will blow away
any other pre-commit hooks).Now you will get an error if you try to do anything fishy!
[](https://asciinema.org/a/0uqf6dcaautz599xru1kefa6b)
# Editing the rules
They are currently in JSON format at `~/.safe-commit-hook/git-deny-patterns.json`.
Just remove the rules you wish to ignore. In the future, would nice to have a `.git-safe-commit-ignore` file for a repo.
# TODO
* [ ] Allow project specific exceptions for safe commit checks.
* [ ] Don't blow away any other git pre-commit hooks in `git init-safe-commit`.
* [ ] Extend the JSON spec to allow for searching for body of modified files.