I finished a project that contains an API Key and I want to upload it to Github. I want to be careful not to expose the API Key on Github.
Two methods I've discovered are
- Using .gitignore to hide the file(s) containing sensitive information
- Simply changing the API Key value to "YOUR-API-KEY-HERE" before uploading to Github. Like so:
ApiKey="YOUR-API-KEY-HERE"
Questions
If the file containing my API Key is 'hidden' in gitignore and I upload my project to Github, will this cause my project to not function properly by anyone who downloads it because the project can't find the 'hidden' API Key? If someone looks at my project on Github, are the 'hidden' files inaccessible to them?
In which cases should I use Gitignore or the "YOUR-API-KEY-HERE" method?