20

Is .DS_Store an important hidden files?, its giving me problems with pulling from github. It is suggesting I remove it and I did. Hope this won't bite me in the butt later on.

Son Truong
  • 233
  • 1
  • 3
  • 7
  • possible duplicate of [How can I Remove .DS\_Store files from a Git repository?](http://stackoverflow.com/questions/107701/how-can-i-remove-ds-store-files-from-a-git-repository) – Whymarrh May 14 '15 at 20:41
  • Check [https://github.com/xiaozhuai/odourless](https://github.com/xiaozhuai/odourless), I made a tool for preventing .DS_Store. – xiaozhuai Dec 13 '19 at 16:28

3 Answers3

18

Just add it to .gitignore, the file has no relevance on other computers.

The .DS_Store file is used to store Finder information about that folder, so it's has no use in a git repo.

Cristik
  • 30,989
  • 25
  • 91
  • 127
  • 3
    Better to add it to a global gitignore file than to the repo's `.gitignore`. See why here: http://stackoverflow.com/a/26851996/2541573 – jub0bs May 14 '15 at 21:00
6

.DS_Store is a Mac-specific hidden file. It's also not something that you generally want to add to source control, as its contents may change without you necessarily interacting with it.

It's safest to place it into your .gitignore file and be done with it. If it's already in your repository, then you can use git rm --cached .DS_Store to remove it from your system after it's been entered into .gitignore.

Makoto
  • 104,088
  • 27
  • 192
  • 230
2

From Wikipedia:

In the Apple macOS operating system, .DS_Store is a file that stores custom attributes of its containing folder, such as the position of icons or the choice of a background image. The name is an abbreviation of Desktop Services Store, reflecting its purpose. It is created and maintained by the Finder application in every folder, and has functions similar to the file desktop.ini in Microsoft Windows. Starting with a full stop (period) character, it is hidden in Finder and many Unix utilities. Its internal structure is proprietary.

You can delete them when you are pushing to GitHub, it will not cause any loss.
See here for more, how to remove properly - https://stackoverflow.com/a/49970762/7718859