git-crypt icon indicating copy to clipboard operation
git-crypt copied to clipboard

Multi-keys setup: Diff + Checkout from other branch impossible when using different keys per branch

Open JohannesFKnauf opened this issue 8 years ago • 2 comments

We have a setup with 3 branches. Each branch has a separate git-crypt key. The feature we are using for that is documented in https://github.com/AGWA/git-crypt/blob/master/doc/multiple_keys.md

When checking out and unlocking branch A (which uses key A), I can neither

  • checkout single files from branch B (which uses key B) nor
  • diff files between branch A and branch B nor
  • show files from branch B
# git checkout B -- myfile
git-crypt: error: encrypted file has been tampered with!
error: external filter "/usr/bin/git-crypt" smudge --key-name=A failed 1
error: external filter "/usr/bin/git-crypt" smudge --key-name=A failed
fatal: myfile: smudge filter git-crypt-A failed

JohannesFKnauf avatar Dec 14 '16 10:12 JohannesFKnauf

I am facing the same issue. Does anyone have any solution how to use multiple keys to encrypt two different set of files?

chandulal avatar Sep 20 '18 07:09 chandulal

A similar error here. In my case, I already had the files in plaintext in the repo, and then have removed and added the encrypted files in a branch.

git-crypt: Error: Unable to open key file - have you unlocked/initialized this repository yet?
error: external filter '"git-crypt" smudge --key-name=test' failed 1
error: external filter '"git-crypt" smudge --key-name=test' failed
fatal: filename: smudge filter git-crypt-test failed

How do I unlock or initialize if a git checkout fails? :/

krish7919 avatar Jan 26 '19 23:01 krish7919