Securing files in git repository-Collection of common programming errors
You shouldn’t add sensitive data to your repository to start with. Instead, add the respective filenames to .gitignore
so you never accidentally commit them.
If you really have to have the files in the repository, use a githook to encrypt the files before committing and decrypt on checkout only if the correct key is present. Here’s a starting point for that. edit In case you really want to do this, git-crypt sounds helpful