Mohammed Dawood Mohammed Dawood - 3 months ago 51
Java Question

Git ignore is not ignoring folder **META-INF**

i'm using git with source tree app i want to ignore the contents of the folder file META-INF like the file persistence.xml

workspace\Data\src\META-INF\persistence.xml


i put the path in .gitignore file

#Ignore META-INF
*/*/src/META-INF/*


but the file not ignored by git , how to ignore all files in this folder META-INF

Answer

Assuming the files are already being tracked by Git, you must do the following:

  1. Fix .gitignore so it is ignoring the META-INF folder

    */META-INF/*
    
  2. Remove the files that should have originally been ignored

    git rm --cached -r
    git add .