Loading... 刚学使用git小心上传了config.json里面包含敏感信息,记录一下删除过程。 从仓库的所有分支和标签中删除config.json文件的记录。 ## 使用git filter-branch删除文件 ```shell git filter-branch --force --index-filter "git rm --cached --ignore-unmatch config.json" --prune-empty --tag-name-filter cat -- --all ``` ## 推送更改 完成上述操作后,你需要强制推送到远程仓库 ```shell git push origin --force --all git push origin --force --tags ``` 最后修改:2024 年 03 月 26 日 © 允许规范转载 打赏 赞赏作者 如果觉得我的文章对你有用,请随意赞赏