MacOS – How to omit directories from Optimized Storage

giticloudmacos

I keep my git repositories in a directory under Documents directory, which puts it in the path of iCloud's Optimized Storage. Often, I'll open a git repository to find files replaced with .icloud placeholder files. Current workaround is resetting the workspace changes, but I sense this may cause some issues.

Example of replacement

Is there a way to exclude subdirectories or files from Optimized Storage? Or any another means to deal with this situation? I do not wish to disable Optimized Storage altogether.

Best Answer

Currently there is no way to exclude subdirectories/files present in Desktop & Documents Folders, if you choose to store them in iCloud and enable Optimize Mac Storage.

A possible workaround for your situation could be to move the git repositories to any directory which is not a subdirectory of ~/Desktop or ~/Documents directory.

A commonly used subdirectory for storing repositories is ~/Developer.