이 세상에 하나는 남기고 가자

이 세상에 하나는 남기고 가자

세상에 필요한 소스코드 한줄 남기고 가자

Mac 에서 git 사용시 한글 파일명 문제 2

유영재

Mac 에서 git 사용시 한글 파일명 문제 라는 글에서 core.precomposeunicode 옵션을 설정해서 한글 파일명 사용시 자소 단위로 분리되는 문제를 해결하는 방법을 소개 했었다. 그런데 맥에서 한글 파일명을 사용할 경우에 다른 문제가 하나더 있다. git status 명령으로 변경 파일을 보면 한글이 \306\301... 와 같이 보이는 문제가 있다. 보이기만 이렇게 보이는 것이면 그냥 참겠지만 commit 하는 등의 과정에서 파일명을 지정하는게 어려워진다. 이 문제를 해결하는 방법은 아래와 같다.

git config --global core.quotepath false
git config --local core.quotepath false

Git Documentation

core.quotePath

Commands that output paths (e.g. ls-files, diff), will quote "unusual" characters in the pathname by enclosing the pathname in double-quotes and escaping those characters with backslashes in the same way C escapes control characters (e.g. \t for TAB, \n for LF, \ for backslash) or bytes with values larger than 0x80 (e.g. octal \302\265 for "micro" in UTF-8). If this variable is set to false, bytes higher than 0x80 are not considered "unusual" any more. Double-quotes, backslash and control characters are always escaped regardless of the setting of this variable. A simple space character is not considered "unusual". Many commands can output pathnames completely verbatim using the -z option. The default value is true.


결론을 이야기 하자면 특별한 이유가 있지 않는 이상 한글 파일명은 사용하지 않는 것이 정신 건강에 좋다. 그래서 나는 가급적 사용하지 않으려고 하지만 간혹 어쩔 수 없이 써야하는 경우가 있어 위 방법들을 남겨둔다.

comments powered by Disqus