I have a file which contains database passwords db/connect.php
.
I created the file and provided the structure for it without passwords:
<?php
$db_host = "localhost";
$db_user = "";
$db_pw = "";
$db_name = "";
$con = new mysqli($db_host, $db_user, $db_pw, $db_name);
/* check connection */
if ($con->connect_errno) {
printf("Connect failed: %s\n", $con->connect_error);
exit();
}
Then I commited the file. In the next commit I added the file to .gitignore
.
But I noticed that it is tracked anyways.
I figured out that git will track all files which are already in the repository, so the only way would be to remove it with git rm --cached db/connect.php
, but then users who clone the repository will need to create it again...??
My question is not about rewriting the git history, there are no sensitive information in the repository. My question is how I can provide the filestructure but not track it after that point so that anything entered in the file should not getting tracked...
How to solve this problem?