Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save lohenyumnam/2b127b9c3d1435dc12a33613c44e6308 to your computer and use it in GitHub Desktop.

Select an option

Save lohenyumnam/2b127b9c3d1435dc12a33613c44e6308 to your computer and use it in GitHub Desktop.

If .DS_Store was never added to your git repository, simply add it to your .gitignore file.

If you don't have one, create a file called

.gitignore

In your the root directory of your app and simply write

**/.DS_Store

In it. This will never allow the .DS_Store file to sneak in your git.

if it's already there, write in your terminal:

find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch

then commit and push the changes to remove the .DS_Store from your remote repo:

git commit -m "Remove .DS_Store from everywhere"

git push origin master

And now add .DS_Store to your .gitignore file, and then again commit and push with the 2 last pieces of code (git commit..., git push...)

Other Solution

If .DS_Store already committed:

find . -name .DS_Store -print0 | xargs -0 git rm --ignore-unmatch

To ignore them in all repository: (sometimes it named ._.DS_Store)

echo ".DS_Store" >> ~/.gitignore_global
echo "._.DS_Store" >> ~/.gitignore_global
echo "**/.DS_Store" >> ~/.gitignore_global
echo "**/._.DS_Store" >> ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global
@muhdavi

muhdavi commented Jul 10, 2022

Copy link
Copy Markdown

thanks, helpful!!!

@hardikpthv

Copy link
Copy Markdown

Thanks!

@njpl3

njpl3 commented Sep 7, 2022

Copy link
Copy Markdown

Worked perfectly, thank you!

@warman-suganda

Copy link
Copy Markdown

thank you

@nivel10

nivel10 commented Dec 4, 2022

Copy link
Copy Markdown

Thank you. Sir...!!!!

@dpayne5532

Copy link
Copy Markdown

Thank you!

@MominAhmedShaikh

Copy link
Copy Markdown

Worked without a flaw! Thanks

@AleksandrosV

Copy link
Copy Markdown

Thank you!

@WICCAN-DEV

Copy link
Copy Markdown

Thank you ๐Ÿ‘๐Ÿป

@faizy-ahmed

Copy link
Copy Markdown

Thank you for the detailed help. It worked for me as soon as I ran the following command:

find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch

@darko55555

Copy link
Copy Markdown

Thanks!

@lpkyrius

Copy link
Copy Markdown

Thanks, buddy!

@ManfredServoy

Copy link
Copy Markdown

Additionally, you might want to add these lines, to make sure your personal Xcode config is not proliferated:

User settings

xcuserdata/

Xcode 8 and earlier

*.xcscmblueprint
*.xccheckout

@ohmohmpr

Copy link
Copy Markdown

Thanks!

@Collins-kariuk

Copy link
Copy Markdown

It worked for me. Thank you!

@Agumerov

Copy link
Copy Markdown

Helped to me add files in gitignore

@ivyzbot

ivyzbot commented Aug 21, 2023

Copy link
Copy Markdown

Many thanks for the clear clarification!

@muhtorres

Copy link
Copy Markdown

Thanks for providing the step-by-step!

@diegofcornejo

Copy link
Copy Markdown

Works great, thanks!

@opsquid

opsquid commented Sep 10, 2023

Copy link
Copy Markdown

Thank you! It saves my day.

@joeybronner

Copy link
Copy Markdown

great, thanks

@muneebwaqas416

Copy link
Copy Markdown

Worked for me .Thanks alot for help

@Sh-Labs-IsuruG

Copy link
Copy Markdown

Thank you. This worked.

@lgirao

lgirao commented Mar 9, 2024

Copy link
Copy Markdown

Thank you! Works for me :)

@royceno

royceno commented Mar 17, 2024

Copy link
Copy Markdown

Thank you!

@rossalynd

Copy link
Copy Markdown

Thank you so much!

@kswdgha

kswdgha commented May 2, 2024

Copy link
Copy Markdown

Thank you! ๐Ÿ‘

@lahiruj

lahiruj commented May 20, 2024

Copy link
Copy Markdown

Hey, buddy this works like a charm! Thank your for this :)

@notagrouch

Copy link
Copy Markdown

Solid!

@jespermhl

Copy link
Copy Markdown

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment