AGWA / AGWA/git-crypt

Pre-commit hook to avoid accidentally adding unencrypted files

Abierto
#45 11 comentarios 2 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
C++
Estrellas
9.9k
Forks
544
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.