shadowhand/git-encrypt

For anyone stuck with an encrypted file and git-encrypt not working anymore

p3k opened this issue · 2 comments

p3k commented

To decrypt e.g. a file foobar.secret:

$ cd your-repo
$ cat .git/config
…
[gitcrypt]
        salt = 0ddba11c0ffee
        pass = "tooquoof8ahK)uozie]xu7naebah5aa3"
        cipher = aes-256-ecb
…
$ pass="tooquoof8ahK)uozie]xu7naebah5aa3"
$ cipher=aes-256-ecb
$ openssl enc -d -base64 -$cipher -k "$pass" < foobar.secret > foobar.decrypted

hope that helps.
😃

brad commented

@p3k Any trick for if we are having trouble encrypting files?

I had to decrypt an old git-encrypt repo on a new machine, so I used the following to decrypt all encrypted files before switching it to git-crypt...

for file in $( git check-attr filter $( git ls-files ) | grep 'filter: encrypt' | cut -d ':' -f 1 ) ; do
  openssl enc -d -base64 -$cipher -k "$pass" < "$file" > "$file.decrypted"
  cp "$file.decrypted" "$file"
  rm "$file.decrypted"
done