DeltaBluee
DeltaBluee

Reputation: 61

Why is my .gitignore file not ignoring specific files?

Why is my .gitignore file not ignoring specific files?

I need to ignore any file which starts with: .metadata/.

I have created a git file ( .gitignore ): Git ignore file

I have added the following text within the ignore file: .metadata/.*

However my file still seems to be showing the files in red:

± |master ↑8 U:44 ?:22 ✗| → git status
On branch master
Your branch is ahead of 'origin/master' by 8 commits.
  (use "git push" to publish your local commits)
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   .metadata/.log
        modified:   .metadata/.mylyn/.tasks.xml.zip
        modified:   .metadata/.mylyn/tasks.xml.zip
        modified:   .metadata/.plugins/com.genuitec.eclipse.devstyle/recent.json
        modified:   .metadata/.plugins/com.genuitec.eclipse.monitor/myeclipse-usage.properties

Upvotes: 3

Views: 5767

Answers (4)

KillerX
KillerX

Reputation: 1466

According to your question the files are already committed. Git will continue reporting changes to ignored files that are committed. In you should remove the files you wish to ignore from your git repo by doing this: https://stackoverflow.com/a/1143800/556085

Specifically :git rm --cached mylogfile.log For a directory: git rm --cached -r mydirectory

Upvotes: 4

grrigore
grrigore

Reputation: 1060

To ignore the metadata folder use **/metadata/*. (make sure you use version 1.8.2 of git or later)

Also, you mistyped .gitignore. (change the name of the file from ,gitignore to .gitignore)

You can also check out this generator -> gitignore.io

Upvotes: 2

nnnmmm
nnnmmm

Reputation: 8804

You appear to have named your file ,gitignore instead of .gitignore.

Upvotes: 0

Joe
Joe

Reputation: 42666

To keep everything out of the ./metadata/ folder from being "seen" by git, add

/metadata/

to your .gitignore file.

Upvotes: -1

Related Questions