• Skip to primary navigation
  • Skip to content
  • Skip to footer
Johnson's Site
  • Posts
  • Cheatsheets
  • Notes
  • Essays
  • Sitemap

    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: June 3, 2018

    Previous Next

    Comments

    • Feed
    © 2023 Johnson. Powered by Jekyll & Minimal Mistakes Template.