tags:

views:

768

answers:

2

Is it possible to automatically encrypt files via 'git push' before transferring to a remote repository? And automatically decode them while 'git pull'.

I.e, if I have some remote server with shared access with git repository there, and I don't want to our project was stolen without a permission... Maybe there is some special git-hooks before push and after pull?

A: 

If arbitrary people have local access to the server or filesystem, your cleanest and easiest bet for security would be to use a different hosting environment. If your code is so valuable, you can afford hosting the repository yourself or paying for private hosting.

If you're trying to use an open-source repository hosting site for free, but securely (by encrypting your code), you're probably breaking their terms of service.

lunixbochs
No offense, but I don't think your comment is helpful, here. What the poster asks is definitely technically possible, and reasonable. I do something similar with iSCSI and dm-crypt, so I can rent cheap, maybe-not-so-secure virtual hosts and rsync my /home backups offsite. I don't see how your comments help--all you do is (A) brush away the tech issues by suggesting he switch hosting providers, and (B) insinuate that he is abusing (e.g.) Github's ToS. The asker has a legit tech question--are you really helping give him a quality technical answer?
Ryan B. Lynch
+2  A: 

Yes and no.

You could try to depend on hook but that suppose they are installed at the remote locations, and that is not always reliable.

Another way to achieve almost the same effet would be by using a smudge/clean attribute filter driver

alt text

That way the smudge script is able decode the files, while the clean script would encode them.

Off course, those scripts would not be in the repository itself, and would be managed/communicated by another way.

VonC
Very good advice! Thanks.I think this method is very useful with custom .gitattributes rules!
UncleMiF
See also http://stackoverflow.com/questions/1557183/is-it-possible-to-include-a-file-in-your-gitconfig
VonC