I am using git and have the following problem:
In the company where I work we want to protect the source code from theft.

For example, when a a developer leaves and takes the source code of a project with him.

To prevent this, I came to the conclusion that encrypting the source code is the best choice, like git-crypt does. But git-crypt does not work:

  • 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 solves my problem?

I don't consider Keybase from this answer, because it encrypts the entire repository. And all people that I will add to the repo have full permission to all the Files.

  • 4
    Possible duplicate of Git files encryption to protect the source code from theft
    – unor
    Apr 9, 2018 at 3:18
  • Can you explain why Keybase app from the other question wouldn't work for you?
    – kenorb
    Apr 9, 2018 at 10:28
  • 1
    Because Keybase Encrypts the complete Repository. And all people that I will add to the Repo has completed Permission to all the Files! Apr 9, 2018 at 10:32
  • 1
    Cross-posted at Devops.
    – kenorb
    Apr 9, 2018 at 11:29
  • 2
    I fail to understand your problem and I believe at its core not to be a technical problem so you will not find a technical solution to it. If some developer works on the code, he obviously has the clear text version of it to work on it. So he can steal it if he wants. The fact that it could be encrypted in the repository is worthless. If you are speaking about other parts of the source code that this developer should not be able to touch, then the problem is more on having correct separate git repositories and filtering access to them appropriately. Apr 9, 2018 at 14:56

1 Answer 1


The encryption of git repository is designed to protect files from the theft from 3rd parties (e.g. when hosted on external servers such as GitHub or S3 Bucket, or by using Keybase), not from the developers working on the project.

You can use Git Submodules, or just different repositories, then give different permissions for each repository, so developers won't have access to the whole project.

Otherwise, if you don't want to give access to the files at all, create a SOAP/REST service for client-server communication to provide only necessary information on the demand. Most of the businesses implements multiple layers of API services to protect their sensitive data from the hacking or theft.

Your Answer

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

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