To remove files that are currently being tracked by git, you have to remove them from the "cache". Note, doing this will NOT delete the file on your local machine. It will still be there but not be tracked.
git rm -r --cached supersecretpasswords.txtYou then need to add the file to the .gitignore file in the root of the project so that it isn't tracked again on your next commit.
.gitignore files are tracked so remember to check in these changes.
vim .gitignore supersecretpasswords.txt
git commit -am'my super secret passwords are safe!'
If you want to completely delete the file, on your local machine and from git
git rm supersecretpasswords.txtIf you're working with a directory remember to add the -r flag for recursive removal!