Removing sensitive data from a git repository

git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch PATH-TO-YOUR-FILE-WITH-SENSITIVE-DATA' --prune-empty --tag-name-filter cat -- --all

execute the command for every path that the sensitive file had exist, replacing PATH-TO-YOUR-FILE-WITH-SENSITIVE-DATA with the path.

Further Reading

  1. Removing sensitive data from a repository | GitHub Help

Posted:

Comments