使用BFG Repo-Cleaner删除敏感文件的历史提交记录

78 阅读1分钟

以Coupon_Finder仓库为例,删除所有application.yml的提交记录。
先要下载BFG的jar包。然后按照以下步骤:

git clone --mirror git clone --mirror https://github.com/YourUserName/Coupon_Finder.git
java -jar bfg.jar --delete-files "application.yml" --no-blob-protection  Coupon_Finder.git
cd Coupon_Finder.git
git reflog expire --expire=now --all && git gc --prune=now --aggressive
git push