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

git-crypt unlock not working

Open jerger opened this issue 7 years ago • 5 comments

Hi,

I try to decrypt a git-crypted file outside of git. We use symmetric en-/decryption with different keys. .gitattributes contains:

*dev_test.properties.enc filter=git-crypt-dev_test diff=git-crypt-dev_test
*dev_live.properties.enc filter=git-crypt-dev_live diff=git-crypt-dev_live
*prod_live.properties.enc filter=git-crypt-prod_live diff=git-crypt-prod_live

Folder looks like:

|-.gitattributes
|-application_credential_dev_live.properties.enc
|-application_credential_dev_test.properties.enc
|-application_credential_prod_live.properties.enc

I try to decrypt lets say the dev_test file with

git init
git-crypt unlock dev_test.key

As result I get:

fatal: You are on a branch yet to be born
Error: 'git checkout' failed
git-crypt has been set up but existing encrypted files have not been decrypted

I've executed openssl dgst -sha256 .git/git-crypt/keys/dev_test on both sides, the sh256 is the same ... do you've any idea?

jerger avatar Mar 07 '18 15:03 jerger

fatal: You are on a branch yet to be born

Is the repo initialised correctly? What's the output of git status?

nicolaiskogheim avatar May 04 '18 13:05 nicolaiskogheim

sorry, we're not using git-crypt any more ...

jerger avatar May 05 '18 08:05 jerger

I see. I'm considering to start using it. Can I ask what the reason was, and what your alternative is?

nicolaiskogheim avatar May 05 '18 08:05 nicolaiskogheim

@jerger bump.

kingbuzzman avatar Nov 15 '18 09:11 kingbuzzman

We use plain openssl roughly like explained here: https://stackoverflow.com/questions/16056135/how-to-use-openssl-to-encrypt-decrypt-files

We trigger encryption / reencryption manually and git-ignore unencrypted files. On reencryption we respect file-timestamps, git-log (if available) & decrypted file-diff in order to reencrypt only if necessary.

git hocked trigger was not necessary for us.

But to be clear, even if we're not using gitcrypt any more, it was a good thing to try ... :-)

jerger avatar Nov 16 '18 16:11 jerger