I'm a software developer and our entire code of the project is stored in a single git repository. A small part of this now needs to be made available to a customer. He does not need to push to the repo nor does he need to pull currently. I would like to use the sparse-checkout feature of git to download the part of the repository which we would like to hand over to the customer. However, I have security concerns about this method.
- Can this method be considered secure such that only the files meant to be exposed are actually downloaded by git?
- Does the sparse checkout also exclude the git meta files (e.g. commit history, etc.)? If the change history is available, I would be concerned, that the entire code could be reconstructed from that.
This question is related to the answers on stackoverflow about the sparse checkout. The topic with the meta files however is not thoroughly covered in that post: https://stackoverflow.com/questions/4114887/is-it-possible-to-do-a-sparse-checkout-without-checking-out-the-whole-repository
There are other solutions apart from the sparse-checkout. I prefer this method, because the customer can further develop the code (incl. versioning) and we could merge those changes back into our repository one day without much extra work. Furthermore we are always able the pull/push during the development phase by entering the credentials by our-self on the premises of the customer.
Update: What currently seems to do the work:
git clone --filter=blob:none --no-checkout --depth 1 --sparse https://path/to/repo.git ./somedir
git sparse-checkout set /some/dir/inside/the/repo
git checkout