1

My project contains the following directories:

moduleA/jars/
moduleB/jars/
moduleC/jars/
...

I want git to ignore all those jars/ folders, so I created a .gitignore file with the following content:

**/jars

Then I commited & pushed everything to remote git repository. But I still see all those jars/ folders in remote git repository, why?

user842225
  • 5,445
  • 15
  • 69
  • 119

1 Answers1

0

First, if those folders are already committed, you need to remove them (from the Git repo, not from the disk, hence the --cached option):

find . -type d -name jars -print0 | xargs -0 git rm -r -f --ignore-unmatch

Second, to ignore a folder, its line in the .gitignore needs to ends with a '/'

jars/
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250