Restore_cache into machine executor from cache saved in docker executor fails with permission denied


I have a large repo that I am caching in a build step using a standard docker executor.

The cache restores with no problem in other docker executors in different jobs.

When trying to restore the same cache in a machine executor, I get a permission error:

Downloading cache archive...
Validating cache...

Unarchiving cache...
tar: root/project/.git: Cannot mkdir: Permission denied
#..lots of the same error elided

Obviously I can just do a fresh checkout and move on but I’d like to take advantage of caching in all build jobs.


Caching a Git folder feels a bit tricky, to me - I tend to think they are files than only Git should be writing to. If you are simply wanting to avoid cloning your project, I would suggest dropping checkout and doing your own git clone. You can then do an export of the branch you want so you don’t have a .git folder at all. The result of that should be cacheable.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.