5

Possible Duplicate:
git encrypt/decrypt remote repository files while push/pull

I'd like to store some private data in a git repository that is going out in the world, basically some private configuration, and so on. I'd like to (somehow) have the file encrypted either as I commit it, or as I push it (preferably the latter, because then I can do reasonable diffs against the text form), and also obviously the inverse.

Is this possible with git's hooks?

Community
  • 1
  • 1
Chris R
  • 17,546
  • 23
  • 105
  • 172

1 Answers1

5

One way of doing this is is to encrypt the objects as they're being staged, and decrypted on checkout. This is rather earlier than doing it solely on push / pull, but might be useful to you.

The way to do this is to use git's "smudge" and "clean" filters, but it's not necessarily recommended for reasons that are explained here by Junio C Hamano, the maintainer of git:

If you still decide to go ahead, you may want to look at this implementation of encrypting/decrypting clean/smudge filters:

Mark Longair
  • 446,582
  • 72
  • 411
  • 327
  • Using git-encrypt with `.git/info/attributes` and then `git push` pushes the decrypted files to the remote repostitory. Thus the remote repository is always decrypted. How do I encrypt it? – pts Aug 23 '12 at 19:36