Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is .gitignore not ignoring .DS_Store? [duplicate]

Tags:

In this case I want to ignore the files iOS uses, and in particular this file

.DS_Store 

I created a .gitignore file as such

touch .gitignore 

and put in a single line

/.DS_Store 

I push to a bare repo which has a hook to checkout to a full repo.

The file keeps showing up in my full repo.

like image 413
cade galt Avatar asked Aug 15 '15 14:08

cade galt


People also ask

Why is my file not being ignored in Gitignore?

gitignore ignores only untracked files. Your files are marked as modified - meaning they were committed in the past, and git now tracks them. To ignore them, you first need to delete them, git rm them, commit and then ignore them.

Should you add DS_Store to Gitignore?

DS_Store file in your directories. It's not a big issue, but often you need to exclude these files explicitly in your . gitignore file, to prevent any unnecessary files in your commit. You may want to ignore this file globally, so next time you don't need to add it to your project's ignore list.

Is Gitignore file ignored?

gitignore file is usually placed in the root directory of a project. You can also create a global . gitignore file and any entries in that file will be ignored in all of your Git repositories. To create a local .


1 Answers

You can also remove committed .DS_Store files like this: git rm --cached .DS_Store

like image 156
wasddd_ Avatar answered Sep 22 '22 15:09

wasddd_