[pass] [PATCH] configure git to decrypt gpg files automatically

Samuel Le Thiec samuel.lethiec at intelunix.fr
Sat May 10 17:18:30 CEST 2014


    - usefull for git commands showing diff, e.g.: pass git log -p
    - from what I can see, not 'cleartext' temporary files are created

---
 src/password-store.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/password-store.sh b/src/password-store.sh
index a4783b4..f466a8f 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -557,6 +557,11 @@ cmd_git() {
 	if [[ $1 == "init" ]]; then
 		git "$@" || exit 1
 		git_add_file "$PREFIX" "Add current contents of password store."
+
+		echo '*.gpg diff=gpg' > "$PREFIX/.gitattributes"
+		git_add_file .gitattributes "Assigning diff attribute for gpg files"
+		git config --local diff.gpg.binary true
+		git config --local diff.gpg.textconv "$GPG ${GPG_OPTS[*]} --decrypt"
 	elif [[ -d $GIT_DIR ]]; then
 		exec git "$@"
 	else
-- 
1.9.2



More information about the Password-Store mailing list