I noticed while working on my new Kubernetes homelab that .DS_Store files were being committed to my Flux GitOps repo. Just documenting how I removed this and prevented future .DS_Store files from being committed.
Remove existing .DS_Store files from the repository:
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
Add .DS_Store to your .gitignore file
echo .DS_Store >> .gitignore
Then commit your changes and push
git add .gitignore
git commit -m "Removed .DS_Store files"
git push origin main
Source:
https://stackoverflow.com/questions/107701/how-can-i-remove-ds-store-files-from-a-git-repository