本文介绍了从所有Git提交中删除敏感信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 假设我有一些敏感信息,例如Git commit中的公司IP地址,实际上可能是100次提交。有没有办法使用Git命令从所有提交中删除/替换该令牌? Github建议最简单的方法是使用名为 BFG repo cleaner 。 如果您要将此回购站推送到集中位置,请确保所有开发人员知道您正在执行的操作。否则,你会得到一些非常不满的人,这些人的存储库非常破碎并且失去了提交。您还需要强制推送到远程,因为您正在重写历史记录。对于每个人来说,这个过程通常是一个巨大的麻烦,这就是为什么我询问IP地址是否足够敏感以保证响应。 在安全方面,如果这些提交有已被公开,您应立即假定提交中信息的机密性受到损害。您应该立即采取适当的安全措施以减轻此时的风险。 Say I have sensitive info, such as a corporate IP address in a Git commit, in fact perhaps 100s of commits. Is there a way to remove/replace that token from all commits using a Git command? 解决方案 Github suggests the easiest way is using a program called BFG repo cleaner.If you're pushing this repo to a centralised location, ensure all the developers know what you are doing beforehand. Otherwise, you'll get some very upset people with very broken repositories and lost commits. You will also need to force a push to remote because you are rewriting history. This process is generally a huge hassle for everyone which is why I asked whether an IP address is sensitive enough to warrant this response.On the security side, if these commits have already been made public, you should immediately assume that the confidentiality of information in the commits are compromised. You should immediately take appropriate security measures to mitigate any risks at this point. 这篇关于从所有Git提交中删除敏感信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-03 20:00