Issue with ignoring subdirectory in git

One of the reasons might be that you already committed that files to your repository. In that case adding them to .gitignore doesn’t prevent git from tracking these files. To fix that you should first remove them from repository like that:

git rm -r target/

(If your project has modules, you need to include the path down to the relevant module’s target:
git rm -r parent_project/module_name/target/)

If you want to remove directory from repository but not from disk you can use --cached option:

git rm -r --cached target/

In any case you should then commit that deletion to the repository (you can do it in the same commit with adding target/ to .gitignore if you wish).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)