Github provide a useful help page on removing files like this. There are also other questions on StackOverflow which cover this
- Completely remove unwanted file from Git repository history
- How can I completely remove a file from a git repository?
See also this section of the Pro Git book, an example given there:
To remove a file named passwords.txt from your entire history, you can
use the –tree-filter option to filter-branch:$ git filter-branch --tree-filter 'rm -f passwords.txt' HEAD Rewrite 6b9b3cf04e7c5686a9cb838c3f36a8cb6a0fc2bd (21/21) Ref 'refs/heads/master' was rewritten
After the cleanup, you could also try a git gc to further compress and clean up for repository.