Read more

Git & Mac: Working with Unicode filenames

Dominik Schöler
August 21, 2013Software engineer at makandra GmbH

I had some problems with Git and the file spec/fixtures/ČeskýÁČĎÉĚÍŇÓŘŠŤÚŮÝŽáčďéěíňóřšťúůýž. After pulling the latest commits, it would show that file as untracked, but adding and committing it would throw error: pathspec 'check in unicode fixture file once again' did not match any file(s) known to git.

Solution

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

Install Git version > 1.8.2 using homebrew Show archive.org snapshot and set

git config --global core.precomposeunicode true

Done.

Reason

According to the linked Stackoverflow post ...

... the cause is the different implementation of how the filesystem stores the file name.
In Unicode, Ü can be represented in two ways, one is by Ü alone, the other is by U + "combining umlaut character". A Unicode string can contain both forms, but as it's confusing to have both, the file system normalizes the unicode string by setting every umlauted-U to Ü, or U + "combining umlaut character".

Linux uses the former method, called Normal-Form-Composed (or NFC), and Mac OS X uses the latter method, called Normal-Form-Decomposed (NFD).

Apparently Git doesn't care about this point and simply uses the byte sequence of the filename, which leads to the problem you're having.

Dominik 08.13: Currently, checking out branches still does not work for me.

Posted by Dominik Schöler to makandra dev (2013-08-21 11:23)