3

I've a database.json, which should contain the database credential of my Zend project, I wonder if I can commit the file with sample credentials and then ignore it, to avoid other new commits...

this is the file:

{
    "development": {
        "resources": {
            "db": {
                "adapter": "PDO_MYSQL",
                "params": {
                    "host":     "hostname",
                    "username": "username",
                    "password": "password",
                    "dbname":   "dbname"
                }
            }
        }
    }
}
cl0udw4lk3r
  • 2,663
  • 5
  • 26
  • 46

1 Answers1

4

If you've already tracked a file, adding it to .gitignore won't work - git will still track the modifications. You could use the following:

git update-index --assume-unchanged database.json

You can then revert that assumption with the --no-assume-unchanged flag:

git update-index --no-assume-unchanged database.json

For reference, here's what GitHub have to say on the matter.

cmbuckley
  • 40,217
  • 9
  • 77
  • 91