First decide how many problematic commits you are dealing with. Filter-branch is powerful, but it is also confusing to use and has bizarre syntax. For me, if the number of problematic commits is <10 I would use rebase, if it's >10 I would use filter branch.
For a filter-branch solution you would normally use the --index-filter form. You would use *.nc in place of filename. But you might need to also add -r for recursive if your nc files are spread out, and you might need to add --prune-empty as well.
git filter-branch --index-filter 'git rm --cached --ignore-unmatch filename' HEAD
For a minimal number of commits git rebase -i HEAD~X
would be simpler. Just change pick to edit, go back, and cleanup the commits to remove the bad files and add the .gitignore in place.
Once you do this - you will have fixed the revision history. You can't garbage collect just yet though.
If you used filter branch it created a bunch of backup refs. You need to delete them with
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
For either a filter or a rebase solution you will also need to expire the reflogs
git reflog expire --expire=now --all
Now you can finally reclaim the disk space the objects are taking up with
git gc --prune=now
That would 'fix' whatever repo you are currently working on. If that isn't the repo on your server then you would need to force push up to the server. That would only fix the refs on the server though, it might not reclaim any disk space. You'd need to expire/gc on the server too.