Roman KlimenkoBlogPhotography

Case-sensitive filenames in git

October 18, 2021


I don't usually change laptops, but when I do, I have the same problem. This problem doesn't show up immediately, but after several months, it happens: I rename a file, it builds just fine on my Mac or Windows, but when I commit, the CI build fails because this file cannot be found on the build server.

The answer is usually simple: by default, Mac OS X and Windows use case-insensitive file systems. In these systems, git and node don't see the difference between, say, Page-Component.js and page-component.js. As a result, require('./Page-Component') works just fine even if the file was renamed to page-component.js. But when I push this commit to CI, and it runs on a Linux machine with a case-sensitive file system, the problem comes - it can't find a file and load a module.

The solution is simple, so I leave it here until the next time:

git config core.ignoreCase false