How to handle accented characters in file names in Git on Mac OS X converted to unicode

后端 未结 2 1789
有刺的猬
有刺的猬 2021-02-14 05:24

In my Git repository, has accented files as éíóúàèìòùãõ_800x600.jpg, but after making clone, I can not do pull, because the file appears as modified:

$git clone          


        
2条回答
  •  孤独总比滥情好
    2021-02-14 06:14

    You need to set the core.precomposeunicode option to true on the Mac, and clone the repository again.

    git config --global core.precomposeunicode true
    

    As described in git config man page, the option is related to the particular decomposition of Unicode characters in Mac OS:

    This option is only used by Mac OS implementation of git. When core.precomposeunicode=true, git reverts the unicode decomposition of filenames done by Mac OS. This is useful when sharing a repository between Mac OS and Linux or Windows. (Git for Windows 1.7.10 or higher is needed, or git under cygwin 1.7). When false, file names are handled fully transparent by git, which is backward compatible with older versions of git.

    What the man page does not indicate, is that this option has no retroactive effect on a repository, it only takes effect in repositories cloned afterwards.

    Reference: Answer by Leo Koppelkamm in "Git and the Umlaut problem on Mac OS X"

提交回复
热议问题