Pre-commit hook to avoid accidentally adding unencrypted files
- Ngôn ngữ chính
- C++
- Star
- 9.9k
- Fork
- 544
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
This should not happen very often, but for users who do not read the doc, or someone who has locked their repository a long time ago and forgot about it, it could be useful to try and prevent this situation:
```
$ git crypt lock # a long time ago... then forgotten
$ echo "secret.file filter=git-crypt diff=git-crypt" >> .gitattributes
$ echo "secret" > secret.file
$ git status # forgot to check using git-crypt status
$ git add secret.file
$ git commit -m "added secret file"
$ git push
```
`secret.file` has been added to `.gitattributes`, but the repository was locked so the person ended up adding it unencrypted.
`git-crypt status` already displays a huge warning in this situation, but it remains possible to make a mistake when it is not run. May I suggest adding to the documentation an example of a pre-commit hook such as this:
```
#!/bin/sh
#pre-commit
git-crypt status | grep "*** WARNING"; test $? -eq 1
```
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.