0

We are working in a Team on a software using a GIT repo. lately we will add external developers with us, the problem is that we dont want to share some data folders with them since they are confidentiel to the company.

Is there a way to manage access of some folders inside the GIT repo ?

Thank you for your responses.

  • git itself does not support this, and I'm pretty sure github only allows you to manage access on a repository level – fredrik Oct 11 '22 at 19:32

1 Answers1

1

No, there is no secure way to share only parts of a repository in Git. The Git documentation describes this in the gitnamespaces(7) manual page, which talks about restricting refs using that feature:

The fetch and push protocols are not designed to prevent one side from stealing data from the other repository that was not intended to be shared. If you have private data that you need to protect from a malicious peer, your best option is to store it in another repository. This applies to both clients and servers. In particular, namespaces on a server are not effective for read access control; you should only grant read access to a namespace to clients that you would trust with read access to the entire repository.

All of this applies to repositories that don't use namespaces as well (which is the case for GitHub). If you need to restrict access to some data, it must live in a separate repository. GitHub uses a modified version of upstream Git on the server side, and thus all of these limitations apply there as well. I'm not aware of any implementation that offers different guarantees.

bk2204
  • 64,793
  • 6
  • 84
  • 100
  • Thank you bk2204 for your answer. Yeah it is what i found so far too. There is a tool called git-crypt which encrypts files within the repo and you can give access based on gpg keys, but i dont know is it a good solution or there are better ways to manage access – Ayoub Boutebal Oct 11 '22 at 20:12
  • Encrypting files within the repo will make most GitHub tools like pull requests very difficult to use. Most companies enforce confidentiality through contracts and legal means, along with limited access where possible, instead of resorting to technical means such as encrypting the contents of the repository. – bk2204 Oct 11 '22 at 20:57