Remove from the diff on github sensitive data

1

I want to delete sensitive data that comes out in the diff when comparing the commits in github, for x reasons I put a sensitive data in a field, and after changing it and pushing it, this data keeps coming out in the commit history as part of a change in a commit, how can I solve this problem, without deleting the commit?

    
asked by Kevin AB 13.10.2016 в 13:11
source

1 answer

2

Being a piece of text inside a file and not a whole file is somewhat more complicated but you can copy the contents of the file and use: git filter-branch or BFG Repo-Cleaner

Head over to here for more information.

Extensive information:

You have to use BFG Repo-Cleaner since it is faster and has more options than git filter-branch :

First you have to create a file and put in the text you want to replace:

$ echo "soy un dato sensible" > toReplace.txt

Then using BFG you have to execute this:

$ git clone --mirror git://example.com/my-repo.git
$ java -jar bfg.jar --replace-text toReplace.txt  my-repo.git

$ cd my-repo.git

$ git reflog expire --expire=now --all && git gc --prune=now --aggressive
$ git push

What will happen is that it will look for "I am sensitive data" and change it for * * * REMOVED * * *

I insist: Read carefully the link to expand the information as it is a sensitive thing.

    
answered by 13.10.2016 / 13:55
source