清除历史记录以获取远程来源的机密数据? [英] Purge history for a pushed confidential data in remote origin?

查看:42
本文介绍了清除历史记录以获取远程来源的机密数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

前一段时间,我们推送了一些包含敏感数据(例如连接字符串)的 app.settings 文件.

A while ago, we've pushed some app.settings files containing sensitive data such as connection strings.

那是很久以前的事情,从那时起,我们删除了(不包含敏感数据)(通过推送新版本).

That was long time ago and since then we've removed (by pushing new versions) which don't contains the sensitive data.

但是,如果有人尝试查看 app.settings 的历史记录-他将看到连接字符串.

However , If someone will try to see app.settings's history - he will see the connection strings.

问题

即使进行历史记录查找,也如何使密码不存在.另外-与之后的一次提交相比,我不想看到连接字符串已被删除.

How can I make the passwords not to be there even with history lookup. Also- I don't want to see that connection strings has been removed compared the one commit after.

说明:我不想删除文件,只需删除几行.

Clarification: I don't want to remove the file , only few lines.

可视化:

2017年-提交- connectionstring = ***,***
2018-提交-删除 connectionstring = ***,***
2019-commits的历史,我将看到敏感数据.

2017 - commit - connectionstring=***,***
2018 - commit - removed connectionstring=***,***
2019 - histroy of commits , I will see the sensitive data.

我想删除2017年的敏感行,但我不想看到2018年现在少了几行(敏感数据将在diff imho中显示).

I want to delete 2017's sensitive lines and I dont want to see that 2018 now has few lines less (the sensitive data , will be displayed in diff imho) .

推荐答案

这是GitHub帮助页面"如前所述,它将涉及重写,然后强制推送Git存储库的整个历史记录.

This is a classic case described in GitHub help page "Removing sensitive data from a repository".
As commented, it will involve rewriting, and then force pushing the entire history of the Git repository.

但是考虑到Git的分布式特性,其他人可能已经克隆了您的存储库(的旧版本).

But considering the distributed nature of Git, other might already have cloned the (old version of) your repository.

这意味着 main 的建议是:首先,现在更改您的连接凭据.
确保旧版本的敏感数据不再敏感.

Which means the main advice is: first and foremost, change your connection credentials now.
Make sure that old versioned sensitive data is no longer sensitive.

然后,您可能会担心清理存储库的历史记录.

Then you can worry about cleaning up the history of your repository.

这篇关于清除历史记录以获取远程来源的机密数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆