1

I cloned a repository from one of our company projects and noticed that there is critical information stored in git, e.g. database passwords, salt key, etc.

I feel responsible to solve this somehow. My only idea is to create a new repository and do it right, but then we loose the whole git history, is this the only solution?

Example filestructure:

app/Main.php
db/connect.php  <-- critical passwords inside

The file db/connect.php is in one of the first commits. One approach would be to add the file to .gitignore and then change the database password, but it won't work with the DB Saltkey ofc.

Black
  • 18,150
  • 39
  • 158
  • 271

1 Answers1

1

You can use git built-in git-filter-branch, for more refer to this answer.

git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch filepattern' --prune-empty --tag-name-filter cat -- --all
LF00
  • 27,015
  • 29
  • 156
  • 295