Home > database >  how can i hide my files in git-hub public repository
how can i hide my files in git-hub public repository

Time:09-22

I want to hide application-dev.yml and application-prod.yml with spring boot from public git-hub repository. But, I don't want to use '.gitignore' file to minimize missing changes. How can i display application-dev.yml and application-prod.yml for me in a public git-hub repository?

CodePudding user response:

There is no way to hide files in a Git repository. The Git documentation on this is very clear: if you need something to be private from people with access to a repository, it needs to be in a different repository.

If these files contain secrets, then you should not check them into any repository. Git repositories are not a good place for secrets, because it sometimes happens that the repository leaks, and if that happens and you have secrets, all of the secrets are leaked.

The best way to store secrets is in a secret store, which can be provided by your CI system as well as standalone tooling (like Vault). These credentials are usually injected into the environment, where the program reads them from on startup. They can also usually be configured to write them to a file on disk if your application needs that.

  • Related