AGWA / git-crypt

Transparent file encryption in git
https://www.agwa.name/projects/git-crypt/
GNU General Public License v3.0
8.28k stars 479 forks source link

Unlock is failing under Windows and Linux (smudge filter failed). #264

Open edpichler opened 2 years ago

edpichler commented 2 years ago

I installed the official version released (git-crypt-0.7.0-x86_64.exe) for Windows and tried to unlock my repository. It seems it fails with some files. Possible encoding problem? This repo is being used successfully in Unix envs.

PS C:\Users\Edu\Documents\GitHub\zettelkasten> git-crypt-0.7.0-x86_64.exe unlock
git-crypt: error: encrypted file has been tampered with!
error: external filter '"C:\\Program Files\\git-crypt\\git-crypt-0.7.0-x86_64.exe" smudge' failed 1
error: external filter '"C:\\Program Files\\git-crypt\\git-crypt-0.7.0-x86_64.exe" smudge' failed
fatal: Company/secrets/git/README.md: smudge filter git-crypt failed
Error: 'git checkout' failed
git-crypt has been set up but existing encrypted files have not been decrypted

The same error is happening in Ubuntu Linux.

edpichler commented 2 years ago

After the 'unlock' everything stop working. I cannot commit/stash/revert and I can't even lock it again because the pending file (showing in the fatal error line) needs to be solved.

maxisam commented 1 year ago

I have the same issue but only in Windows, it works fine in my Ubuntu 20.04 WSL2

maxisam commented 1 year ago

I figured it out. It is because of CRLF. It is easy to workaround this issue.

the secret file has to be LF use

eol=lf filter=git-crypt diff=git-crypt to ensure it doesn't get converted to CRLF in Windows

viktorgt commented 1 year ago

I just wanted to share that I spent quite a few hours debugging this issue.