An alternative solution is to create a new local branch where you modify .gitignore, so the secret-file can be clicked on the hero. DO NOT move this branch to the Github repository.
To direct a non-leading branch to a hero, use:
git push heroku secret-branch:master
More information can be found at:
https://devcenter.heroku.com/articles/multiple-environments#advanced-linking-local-branches-to-remote-apps
Use heroku run bash and then ls to check if your secret file was clicked on the hero or not
Advantages over other solution:
Keep the secret file in your favorite format;)
source share