Skip to content

Instantly share code, notes, and snippets.

@aschiavon91
Created February 18, 2022 14:27
Show Gist options
  • Select an option

  • Save aschiavon91/ce2fca65e7fe4d2f5a71089767db9770 to your computer and use it in GitHub Desktop.

Select an option

Save aschiavon91/ce2fca65e7fe4d2f5a71089767db9770 to your computer and use it in GitHub Desktop.
Delete priv keys from git history

Install BFG

cd /usr/local/bin
wget https://repo1.maven.org/maven2/com/madgag/bfg/1.14.0/bfg-1.14.0.jar -O bfg-latest.jar
echo -e "java -jar /usr/local/bin/bfg-latest.jar \$@" | sudo tee /usr/local/bin/bfg

Delete Keys

bfg --delete-files key_priv.pem .git

After BFG execution

git reflog expire --expire=now --all && git gc --prune=now --aggressive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment