OneDrive and git - don't do it

I recently turned on OneDrive's "Known Folder Move" feature, which syncs your "known folders" (Documents, Downloads, and Pictures) to OneDrive. I had been keeping my git repositories in my Documents folder, which means they were now being synced to OneDrive.

tl;dr - OneDrive's known folder move is nice for general use, but don't put your git repositories in a folder synced by OneDrive (e.g. %UserProfile%\Documents\GitHub\)

Why not?

By default, OneDrive will try to save space by removing files that haven't been used in a while (re-downloading them when necessary). Think of how this could affect a node_modules or venv folder; need to work on a project you haven't touched in a week? Gotta wait while OneDrive re-downloads thousands of files. Running npm install for the first time in a project? OneDrive is about to go nuts trying to sync thousands of files. You can mitigate some of these issues - e.g. marking folders "always keep on device" - but even then, these things really do get in the way.

There's also often some hooplah involved when deleting a repository (remember that pesky node_modules folder with thousands of files?). OneDrive also has some restrictions on what types of files will be synced, and some other restrictions that you might run into as a developer (e.g. certain characters not allowed in filenames). If any of these restrictions are violated you'll get complaints from OneDrive. Not worth the hassle in my opinion.

I started keeping git repositories in the root of my user profile, sometimes within a subfolder there (e.g. %UserProfile%\GitHub). Obviously the repositories won't be backed up in OneDrive, but if something happens to my computer, I can just clone the repository again and reinstall the packages (assuming I've been pushing changes to remote/origin regularly)

Known folder move is great for most other, non-repository things though!

Show Comments