Technology / 

07 Jan 2019

“One Weird Trick” for Git on ExFAT

Just a quick one-liner that I found useful: sometimes it’s useful to put a Git repo onto a portable storage device and carry it around, perhaps so you can work on it at a friends’ place, without dealing with SSH keys and opening ports, or putting the thing up on GitHub. (Although GitHub just decided to get with the times, or at least the competition, and now does free private repos, just like GitLab.)

Anyway, if you haven’t tried this… it seems perfectly reasonable, up until Git starts throwing a bunch of errors at you when you try to pull or do much of anything else.

The key, as it turns out, is to disable Git’s file mode support, which ExFAT isn’t compatible with (ExFAT doesn’t really do metadata). Once you do this, the repo will function more-or-less normally.

From inside the repo, run:

git config core.fileMode false

That’s it. As long as you don’t use file modes for anything significant in the repository (and you probably shouldn’t, if you’re collaborating across various platforms), you probably won’t notice that it’s been disabled. Worst case, when you get back to a system that does care about file modes, you might need to fix some execute bits and commit.

This took me entirely too long to figure out, so I’m putting it here for posterity.