I have a Git repository that is private, and the server and database it supports are both fully contained within an internal network. The application.properties file in my project contains sensitive information such as database credentials and server configuration details.
Given the following context:
Do I still need to add the application.properties file to .gitignore, or is it safe to keep it in the repository?
I understand that .gitignore is commonly used to prevent sensitive files from being committed, but since this is a private and secured setup, I am unsure if this step is necessary. Are there potential risks or best practices I should consider even in this setup?
I’m looking for guidance on whether I should:
Any advice or insights would be appreciated 👍
Thank you!
The answer is YES
If you use GitHub or other similar resources, even though they were trustworthy so far, out of principle never ever push your secrets to servers you do not fully control.
It is like telling all your secrets in private to someone who proved to be trustworthy. You wouldn't feel too safe while doing so. What if GitHub's server is hijacked, someone leaks out your secrets, etc.?
And even if you do not use GitHub and you only have a git repo on the server. Developers will eventually clone it to their development machines and by accident leak the information. And then you will have problems.