25/04/2024

git-crypt headache

Just a quick tip to remind myself how to properly commit some data that needs to be encrypted with git-crypt.

First of all, if you need to change files pattern or paths of the data you need to encrypt you have to change your .gitattributes file:

  1. git clone the encrypted repo
  2. modify .gitattributes
  3. git add & git commit
  4. git push

In case you only have to change encrypted files or add new encrypted files

  1. git clone the encrypted repo
  2. unlock it with “git-crypt unlock <key path>”
  3. verify files are not crypted with “git-crypt status ; file <encrypted files path>”.
    If they’re shown as “data” it means they’re still encrypted (unless they’re binary data by themself)
  4. add/change files
  5. git add & git commit
  6. git-crypt lock
  7. verify files are encrypted before pushing repo with “git-crypt status ; file <encrypted files path>”
  8. git push

After all this you can blame yourself for turning one more simple thing into a hard one.

I commenti sono bloccati.