cannot add folder to gitignore file
This question already has an answer here:
Git doesn't ignore tracked files. You need to delete that file from the repository before it will be ignored:
$ git rm -r Index
$ git commit -m "Deleting 'Index' folder."
 This will remove the files.  If you only want to remove them from the index use --cached :  
$ git rm -r --cached Index
This will keep all files in the file-system and only removes them from git.
 To exclude the the Index folder, remove it and commit the changes.  This is outlined in:  
 That simple it is.  If you only want to update the index telling git that nothing changed even it changed, use the update-index commmand:  
上一篇: .gitignore不会忽略package.json
下一篇: 无法将文件夹添加到gitignore文件
