Skip to main content

Case-sensitivity problem with Git in OS X

I've several times experienced problems with files and folders having incorrect case in Git repositories in OS X, so I decided to gather some possible fixes and solutions to this problem. If you have any suggestions or comments, please consider sharing it with me in a comment.

Hacks

First off, here's a solution published at Coderwall.com:

git mv filename filename_tmp
git mv filename_tmp Filename
git commit -m "Set correct case for filename"

The author mentions that this is a hack and that it could possibly mess up other users' repositories, and that a git pull by other users won't include this change.

In a comment to that article, a user suggests the following approach instead:

git mv --force filename Filename
git commit -m "Set correct case for filename"

According to the comment, a git pull would now rename the file for other OS X users as well.


A permanent fix

As mentioned in both the article at Coderwall.com, and by several users in this Stackexchange post, OS X's filesystem uses a case-preserving format, not a case-sensitive format. There are ways to get around this when working with a repository, though. Both articles suggests creating a disk image with a case-sensitive format, more specifically the Mac OS Extended (Case-sensitive, Journaled) format.

Here's a slightly rewritten version of the step-by-step list found in the article at Coderwall.com, explaining how to create such a disk image:

  1. Launch Disk Utility
  2. Choose "New Image"
  3. Enter a name for your volume, e.g "Workspace"
  4. Set the size to something that will most likely fit your needs
  5. Select Mac OS Extended (Case-sensitive, Journaled) in "Format".
  6. Select "Single Partition - Apple Partition Map" in "Partitions"
  7. Ensure "Sparse bundle disk image" is set in "Image Format".
  8. Save it somewhere on your hard drive

The final step is to move any Git repositories to this new disk image. Any problems you've had with case-sensitivity will now be history.

Next steps

Here are a few things you can do:

2026

September

  • Note

    As quite evident by looking at my brand new reading page, I haven't read very much this year. Going forward I will do my very best to finish the books I'm currently reading and find some new exciting books to read. Currently only finished three, the goal is 10!

  • Note

    I just ordered a Fairphone 6+, Fairbuds and Fairbuds XL.

    I have an iPhone 17 as my daily driver, but I couldn't help but order this phone and headsets once I became aware it was a thing.

    My plan is to switch to all of these things, replacing my iPhone 17, AirPods Pro 3 and Bose QuietComfort Ultra. These will either be sold or given to someone who needs them.

    The initiative is great and their values even better. We need companies trying to counter the enormous pressure laid upon all of us to keep buying stuff all the time.

    I will post a thorough review of these items once I've used them for a while.

  • Tømmerneset rock carvings

2025

April

  • Note

    I will be posting changes to my website simply as notes tagged with changelog. This is the very first changelog of this site, and it summarizes the most important changes I've done since I started wiping the dust of this site in April this year.

    • I've added a Buttondown newsletter integration. Whenever I publish a new post on my blog, an email will be sent to my subscribers.
    • I've added a «Reply by email» button to all content. Do not hestitate to contact me if you have comments or feedback. Getting feedback is a big part of why I blog in the first place — I enjoy hearing from readers and being part of a thoughtful exchange now and then.
    • I've added a Search feature using Pagefind. It's not yet fully configured or customized, but it's working.
    • Added links to previous and next post, note and link.
    • Added a 404 page.
    • Reduced the size of uncompressed resources being loaded on the front page to 66 kB. Submitted a PR to be added to the 512kb.club website.
  • Our dog: Kento
  • Note

    This is the very first note on my new website. It's a GREAT note.

    It doesn't say much, but still – it marks the beginning of a new note-hosting era for this website.

  • Back to basics – again..