8

I'm using a CI build that downloads a zip archive from github. At build time, I need to decrypt a file that has been encrypted with git-crypt using gpg. However, the CI build cannot decrypt the files because it is not a cloned directory tree and thus I cannot run 'git crypt unlock'.

I see the .git-crypt tree, but what are the manual steps to gpg to decrypt a file?

SenseDeep
  • 3,026
  • 3
  • 17
  • 19

1 Answers1

4

Assuming you have the GPG key that the directory was encrypted with, just do the following:

cd encrypted-directory
git init
git-crypt unlock gpg.key
Dominic Cerisano
  • 3,522
  • 1
  • 31
  • 44
  • git-crypt minimally requires an initialized repo (git init). – Dominic Cerisano Aug 07 '17 at 22:57
  • Clever approach! You probably want to remember to clean up the new .git directory once you've reclaimed your data. – Andrew Apr 07 '18 at 00:09
  • Actually removing the .git dependency from a locked git-crypted repo is unadvised in the first place. The OP likely forgot to unlock the repo first, and is very lucky this solution worked. A tribute to the git-crypt designer. – Dominic Cerisano Apr 08 '18 at 00:44
  • 1
    I had a similar problem and ended up writing a small article on the full set-up https://thearjunmdas.github.io/entries/encrypt-decrypt-files-with-git. – ArMD Nov 11 '20 at 03:19