--- tags: Git, disqus: hackmd --- ###### tags: `Git` `.DS_Store` `gitignore` # Git忽略追蹤.DS_Store 參考文章 [[筆記] Git 忽略 .DS_Store 等排除檔案](https://smlpoints.com/notes-git-ignore-ds_store-files-and-so-on-gitignore.html) --- 在根(~)目錄建立一個檔案叫`~/.gitignore_global`,不用副檔名。 然後在裡面寫上要忽略的檔案再儲存。 ``` .DS_Store .DS_Store? ``` 去終端機(Terminal)輸入下面指令。 ``` git config --global core.excludesfile ~/.gitignore_global ``` ### 刪除已追蹤的.DS_Store ``` git rm --cached .DS_Store ``` 這行指令會把你當前資料夾的.DS_Store追蹤給刪除。 ### 不想全域忽略追蹤 只想在某專案資料夾忽略追蹤,那就在該資料夾建立一個`.gitignore`的檔案。 然後一樣在裡面打上`.DS_Store`就可以。