최말짱 블로그

[mac] '.DS_Store' 파일 삭제하는 법 본문

카테고리 없음

[mac] '.DS_Store' 파일 삭제하는 법

최말짱 2023. 1. 25. 19:19
728x90

 

 

 

 

 

git push를 할 때 .DS_Store 파일이 거슬려 이 파일이 무슨 파일인지 삭제해도 되는지 알아보았다.

 

 

.DS_Store 파일이란?

Desktop Services Store의 약자이며, Apple macOS 운영 체제에서 .DS_Store 는 폴더 보기 옵션, 아이콘 위치 및 기타 시각적 정보 와 같이 포함하는 폴더의 사용자 정의 속성을 저장하는 파일입니다. 

https://en.wikipedia.org/wiki/.DS_Store

 

.DS_Store - Wikipedia

From Wikipedia, the free encyclopedia Proprietary format hidden file In the Apple macOS operating system, .DS_Store is a file that stores custom attributes of its containing folder, such as folder view options, icon positions, and other visual information.

en.wikipedia.org

 

 

 

파일을 지우면 다시 생성되고.. 결국 깃허브에서 해당 파일까지 push 할 수 밖에 없는데

 

해결방법은 

1. 파일 삭제하기 

2. .gitignore에 추가하기

 

를 해주면 된다 ! 

 

 

 

1. 파일 삭제하기 

.DS_Store이 포함되어 있는 폴더에서 해당 명령어를 입력하여 파일을 지운다.

find . -name .DS_Store -print0 | xargs -0 git rm --ignore-unmatch -f

2. .gitignore에 추가하기

다음 명령어를 입력한 후 push 해주면서 깃허브에 반영해준다.

echo .DS_Store >> .gitignore
git add .gitignore
git commit -m ".DS_Store 파일 무시"