突然看到阿里云的accessKey泄漏邮件才发现自己不小心把key传到github上了,

赶紧从床上爬起来开电脑准备删文件,第一反应就是用filter-branch彻底删除历史中的这个文件,强制推送覆盖github上的版本,

命令随便就能搜到,

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

但是,但是从阿里云给的泄漏地址打开居然还能打开泄漏key的文件,

仔细一看阿里云打开的是特定版本的文件,哪怕这个版本已经不在最终仓库里了,github还是能打开的,

也就是说光自己删除数据是没用的,这看起来是github缓存已经删除了的commit,

肯定要想办法删除这些缓存才行,

于是找到github官方文档,

https://docs.github.com/cn/github/authenticating-to-github/removing-sensitive-data-from-a-repository

其中第8点明确说了要联系GitHub 支持删除缓存之类,

赶紧设置成private仓库,然后睡觉去了,

第二天起来发支持工单,让github帮忙删除,

04.18 11:39

标题:

Removing sensitive data from a repository

内容:

I submitted sensitive data to these two commits,

https://github.com/AoEiuV020/LetsEncryptManualHook/tree/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx https://github.com/AoEiuV020/LetsEncryptManualHook/tree/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx