Reputation: 3885
I have a file "src/data/sensitive-data.json" that contains contents:
{
"appInstanceKey": "<Virtual App Key Here>",
"email": "<Email Here>",
"password": "<Password Here>"
}
I pushed that to my repo.
I now added to my .gitignore
src/data/sensitive-data.json
and then pushed that to my repo in a separate commit.
I want to now change my sensitive-data.json to actual credentials so i make the change and tell git to stop tracking with SourceTree (i believe it's using git rm -r --cached) and push that.
The problem is when someone new pulls the repo, the data folder and the sensitive-data.json file don't exist at all. I want it to exist with the original contents, but I want to be able to change the data locally without it being tracked.
What step did I mess up or what am I missing to accomplish this? I looked at other SO answers and I feel like i'm following them correctly.
Thank you
Upvotes: 0
Views: 79
Reputation: 1606
There is a great article on github about removing sensitive data from repository, but maybe you should consider having structure like this:
/src/data/sensitive-data.json <-- This is not tracked by git at all
/src/data/sensitive-data.json.example <-- This is tracked by git
Having structure like that ensures that future code users will know how the file should be looking and it is pretty safe for you to not include sensitive data in your repository.
Upvotes: 2