Skip to content

Managing sensitive data in git projects

Many of my projects have files that contain usernames/passwords for various services (e.g. MySQL). For a public project on Github, this is unacceptable. Here is a solution:

  1. Make a duplicate of the file named <filename>_sample and remove the sensitive data from it.
  2. Add a line to your .gitignore file to untrack/ignore the file.
  3. If the file was previously tracked you must untrack it with
    git rm --cached <filename>

The sensitive file will not be added to your future commits.

Categories: Git, Github.

Comment Feed

No Responses (yet)



Some HTML is OK

or, reply to this post via trackback.