AGWA / git-crypt

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

`git checkout` to different branch that have encrypted file failed #125

Open yujinlim opened 7 years ago

yujinlim commented 7 years ago
> git checkout feature/xxx
git-crypt: error: encrypted file has been tampered with!
error: external filter "git-crypt" smudge failed 1
error: external filter "git-crypt" smudge failed
fatal: /path/to/file/cacert.pem: smudge filter git-crypt failed

I have some encrypted file in this feature/xxx branch that doesn't exists in my current branch, when i try to checkout to it, it seems there is a failure on filter process of git-crypt. Has anyone encountered this before?

sx5640 commented 5 years ago

I hand the same issue. git crypt lock then checkout worked for me for checking out the branch, but can't unlock afterwards

agconti commented 3 years ago

@yujinlim using the method outlined here to resolve this worked for me: https://github.com/AGWA/git-crypt/issues/78#issuecomment-278071567

akindo commented 3 years ago

I hand the same issue. git crypt lock then checkout worked for me for checking out the branch, but can't unlock afterwards

This worked for me, thanks @sx5640! Will create an issue suggesting git-crypt lock gets documented in the README.

rvansa commented 1 year ago

I think that git-crypt should actually lock (remove symmetric key) when checking out a different branch. I want to have different branches encrypted with a different key (accessible to different users). When I go from an encrypted branch to non-encrypted and type git crypt init there the key is already present; I need to do git crypt lock. Otherwise I could accidentally use the same symmetric key for different user sets.