I am using git and have the following problem: In the company where I work you now want to protect the source code from theft. So if for some reason a developer lets the source code of a project go along and sells it, for example. To prevent this, I thought about it for a long time and came to the conclusion that encrypting the source code is the best choice. Like git-crypt does, that's a very good idea. Only with one mistake: If I add a user's GPG key, he can decrypt all files, and the protection measure would be worthless. The files of the developer should be decrypted locally and only remotely. (This way the developer does not always have to encrypt, push, decrypt the files)

I tried to re-program git-crypt in Python (because of cross-platform) but then failed due to the git attributes/smudge, clean filter drivers.

Do you know a possibility or an application that takes up exactly my problem?

  • 3
    As long as someone can read it to work on it, they can wrongly push to a public repo unencrypted or just copy the files somewhere... That sounds just bringing complexity with no real solution.
    – Tensibai
    Apr 8, 2018 at 17:14
  • 1
    Cross posted on Engineering, then migrated to Softwarerecs, then posted again on Softwarerecs, and posted here.
    – kenorb
    Apr 9, 2018 at 11:22
  • 1
    I joined this site just to vote to close (and forgot that I wouldn't have the rep :-) I am extremely surprised that there are, as yet, no closevotes, despite @kenorb's comment two days ago
    – Mawg
    Apr 12, 2018 at 10:36

1 Answer 1


There really is no way to take on your problem with git, which is to deny a developer with access to the code (required to work with it) the possibility to steal the code. This is because as soon as your developer has the code in a readable format (to program on it), he can do with it whatever he wants, anyways.

git-crypt has a totally different use, and is not related to your problem at all.

To solve your problem, there is basically only one possibility: lock the network in which the code resides down completely - make it so that there is no physical way to transfer the code to the outside. This could mean:

  • No direct internet connection, obviously.
  • No http/https proxy either, no mail clients etc.
  • No way to add new devices to the network (unless through official ways). E.g., no unused network ports to plug anything in; no guest DHCP; MAC address filtering; no WIFI, smartphones; etc.
  • No way to plug an USB device or other transfer mechanism into any devices.

This may sound harsh, but really is not. It could be as simple as keeping your code strictly within a set of VMs, accessed by something like Vmware Horizon or something like that, with cut&paste and file transfer disabled, of course. Be nice to your developers and allow them to transfer stuff into the environment (their favourite editor, for example).

The measures so far do not require any physical changes, i.e. your developers still can work remotely or in their usual unsecure office. Obviously, they still can go to extreme measures (screenshots on their client PC...) to get specific parts of the code page-by-page.

To go a step further, in increasing severity (although we are going into James Bond territory here...):

  • Strict policy with severe punishment. Setup a specific contract which each emplyee which contains clauses as harsh as the laws of your country allow.
  • Switching access to the limited network to a physical area in your office.
  • Security measures like locked doors accessible to only specific personnel, video cameras with 24/7 human supervision and so on.
  • 2-factor access (either 2 persons required to checkout code, or at least a physical TAN generator or something along those lines).

Note that in your case you want to make it hard for a thief who knows that he is doing something illegal and already has committed to doing a crime. He will not respect any "weak" protection (like rules/laws) anyways.

  • 1
    You forgot: "No phones" ;) No technical approach can be 100% effective against determined enough malicious intent: some people have a really good memory, others can understand really well what the code does. In either case the code or its equivalent can be reproduced outside the technical barriers. Apr 9, 2018 at 3:10
  • Absolutely, @DanCornilescu. I didn't want to stray too much into James Bond territory. ;)
    – AnoE
    Apr 9, 2018 at 6:14
  • Unless you can also control the remote access machines, there is no way to stop someone from screen shotting the code and running some OCR. Or in the worst case typing it out manually. Securing something that you also give access to is kind of pointless as it can all be gotten around.
    – jecxjo
    Apr 9, 2018 at 20:20
  • Yes, I mentioned that, @jecxjo. This answer is not so much about providing a solution to an ultra secure high-risk military software development complex, but to put into perspective why git-crypt is not the correct tool of choice...
    – AnoE
    Apr 9, 2018 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.