How can I remove those annoying Mac OS X .DS_Store
files from a Git repository?
相关问题
- Xcode debugger displays incorrect values for varia
- Is there a way to report errors in Apple documenta
- Why does recursive submodule update from github fa
- Extended message for commit via Visual Studio Code
- Advice for supporting both Mac and Windows Desktop
相关文章
- 请教Git如何克隆本地库?
- 现在使用swift开发ios应用好还是swift?
- Visual Studio Code, MAC OS X, OmniSharp server is
- xcode 4 garbage collection removed?
- IntelliJ IDEA can't open projects or add SDK o
- Automator: How do I use the Choose from List actio
- ImportError: No module named twisted.persisted.sty
- How can I vertically align my status bar item text
Combining benzado and webmat's answers, updating with
git rm
, not failing on files found that aren't in repo, and making it paste-able generically for any user:There are a few solutions to resolve this problem. To avoid creating .DS_Store files, do not to use the OS X Finder to view folders. An alternative way to view folders is to use UNIX command line. To remove the .DS_Store files a third-party product called DS_Store Terminator can be used. To delete the .DS_Store files from the entire system a UNIX shell command can be used. Launch Terminal from Applications:Utilities At the UNIX shell prompt enter the following UNIX command: sudo find / -name ".DS_Store" -depth -exec rm {} \; When prompted for a password enter the Mac OS X Administrator password.
This command is to find and remove all occurrences of .DS_Store starting from the root (/) of the file system through the entire machine. To configure this command to run as a scheduled task follow the steps below: Launch Terminal from Applications:Utilities At the UNIX shell prompt enter the following UNIX command:
sudo crontab -e When prompted for a password enter the Mac OS X Administrator password. Once in the vi editor press the letter I on your keyboard once and enter the following:
15 1 * * * root find / -name ".DS_Store" -depth -exec rm {} \;
This is called crontab entry, which has the following format:
Minute Hour DayOfMonth Month DayOfWeek User Command.
The crontab entry means that the command will be executed by the system automatically at 1:15 AM everyday by the account called root.
The command starts from find all the way to . If the system is not running this command will not get executed.
To save the entry press the Esc key once, then simultaneously press Shift + z+ z.
Note: Information in Step 4 is for the vi editor only.
add this to your file .gitignore
save this and make commit
and now you ignore this for all your commits
This worked for me, combo of two answers from above:
The best solution to tackle this issue is to Globally ignore these files from all the git repos on your system. This can be done by creating a global gitignore file like:
Adding Rules for ignoring files like:
Now, add this file to your global git config:
Edit:
Removed Icons as they might need to be committed as application assets.
I had to change git-rm to git rm in the above to get it to work: