Git 전역 ignore 파일

dev | 2019-06-29

개인적으로는 전역 설정보다는 저장소마다 .gitignore를 상세히 설정하는 것을 선호한다. 그런데 지금 다니는 회사는 대부분의 어플리케이션을 파이썬으로 만들다 보니 파이썬에서 만드는 임시파일이 .gitignore에 등록되지 있지 않은 경우를 자주 볼 수 있었다. 그래서 전역 설정에 대해서 살펴봤는데 대부분 전역 설정파일을 만들고 그 파일을 사용하는 방법을 추천하고 있었다.

git config --global core.excludesfile '~/.gitignore'

기본으로 참조하는 파일이 있을 것 같아서 찾아보니 Git 메뉴얼에 보통은 core.excludesFile을 설정해서 쓰지만 기본위치가 있다고 잘 나와있다.

Patterns which a user wants Git to ignore in all situations (e.g., backup or temporary files generated by the user’s editor of choice) generally go into a file specified by core.excludesFile in the user’s ~/.gitconfig. Its default value is $XDG_CONFIG_HOME/git/ignore. If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/ignore is used instead.

무설정을 선호하기 때문에 ~/.config/git/ignore 파일을 만들고 설정하니 잘 적용된다.

현재 시스템의 core.excludesfile 설정을 보려면 아래와 같이 입력하면 된다.

git config --get core.excludesfile

Comments

    Post a comment

    :

    : 공개 되지 않습니다. Gravatar를 표시 합니다.

    :

    : HTML 태그를 사용할 수 없습니다.