⚒️ mac OS로 git을 사용하다 보면 .DS_Stroe라는 파일이 계속 생성되어서 Commit시에 불필요한 파일이 계속 올라간다...
✅ .DS_Store란?
- Desktop Service Store의 약자이며, 애플에서 정의한 파일 포멧이다.
- MacOS 시스템이 폴더에 접근할 때 해당 폴더에 대한 메타 데이터를 저장하는 파일
- 해당 파일의 크기, 아이콘의 위치, 폴더의 배경정도 등등...이 담겨있다.
❓.DS_Store의 역할?
- Spotlight Comment : Mac에서는 파일에 원하는 태그를 걸면, 파일 탐새기와 같은 기능을 하는 Spotlight에서 빠르게 검색 가능
- Timestamp : 구조체의 modD, moDD 영역에 해당하는 부분. 파일의 수정 시간과 관련 정보 획득 가능
- 해당 디렉토리의 논리적, 물리적 크기에 대한 정보.
[루트 디렉토리에서 아래 명령어로 .DS_Store파일을 모두 삭제한다.]
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
https://www.toptal.com/developers/gitignore
위 링크에 들어가서 본인의 운영체제, 작업 환경에 맞게 .gitignore 코드를 생성한다.
생성버튼을 눌러서 화면에 나온 내용을 복사한다.
# Created by https://www.toptal.com/developers/gitignore/api/macos
# Edit at https://www.toptal.com/developers/gitignore?templates=macos
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### macOS Patch ###
# iCloud generated files
*.icloud
# End of https://www.toptal.com/developers/gitignore/api/macos
급하신분들은 위 내용을 복사해서 쓰셔도 됩니다.
위 내용을 복사한 후 메모장 또는 텍스트 에디터로 ".gitignore" 로 파일이름을 저장하고 프로젝트 폴더에 '.git 폴더' 옆에 두면
이 문제를 해결할 수 있다.
'꿀팁 > Mac' 카테고리의 다른 글
[Mac] 이클립스 오류 "eclipse 응용프로그램이 예기치 않게 종료되었습니다." (0) | 2023.06.17 |
---|---|
[Mac]맥북 벽돌.... "apple.com/support -1008F"오류...사망...잘가 (2) | 2023.06.17 |
[맥] 마우스 감도 윈도우처럼 바꾸기! (4) | 2023.06.09 |