Purge history for a pushed confidential data in remote origin?

谁都会走 提交于 2021-02-18 22:30:48

问题


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.

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

Question

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.

Visualization:

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

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) .


回答1:


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.

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

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.



来源:https://stackoverflow.com/questions/57122756/purge-history-for-a-pushed-confidential-data-in-remote-origin

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!