Cannot cache .git folder

site: https://hungry-fermat-2b59d3.netlify.app/

log: https://app.netlify.com/sites/hungry-fermat-2b59d3/deploys/5ea3de8741a4cc00068d82a1

Hi, I use netlify for deploying my gatsby site. I use https://github.com/theowenyoung/gatsby-source-git for fetch post from remote git, and I also use https://github.com/jlengstorf/netlify-plugin-gatsby-cache for caching gatsby build cache.

Here is the problem. gatsby-source-git plugin clone git repo to .cache/gatsby-source-git/blog, it include .git folder in it, but when netlify-plugin-gatsby-cache cache the .cache folder, .cache/gatsby-source-git/blog/.git folder is gone, the other cache is normal, I don’t know why, and I try it at zeit platform, it works fine, log: https://vercel.com/theowenyoung/theowenyoung-github-io/fmeofki8b

I don’t know it’s a netlify-plugin-gatsby-cache problem or netlify problem, is there someone know it? Thanks

Hi @theowenyoung, not sure if you are using the gatsby-cache plugin to also cache that .git folder. Perhaps, you’ll need to explicitly configure that since our buildbot won’t automatically cache a .git folder that is not the root of the repository.

Additionally, instead of having a nested git repository in your repo, have you considered included the other repo as a submodule (via git submodule add) which our buildbot supports natively?

Let me know if that helps.

Hi, I have to say that caching a .git folder is a more proper way for my case. so how to explicitly configure to cache the .git folder?

Thank you.

You could probably try using this: cache-me-outside. That package allows you to explicitly define folders to cache.