This is what I use, and I think you’ll want to as well. It’s close to the other answers, but instructs git to NOT change the local files.
git rm -r -f --cached DirectoryName
- -r : recursive
- -f : force
- –cached : apply ONLY to index (staging area). Git leaves the local copies alone.