Reputation: 1939
What's a good practice for dealing with what should be ignored in a .net project?
I guess this is subjective to certain conditions but for example I have a binary that is referenced to the project and another dev in my team doesn't have a copy of this binary. Should I not add the bin folder in the .gitignore and build the source with the binary file set to be copied to the bin for convenience?
Also, for security purposes, how should we deal with the config files? Should it be added on the .gitignore or should we just remove production related credentials (like connection strings and certain keys in app settings with sensitive values.) If config files are added to .gitignore, where then should we store the production/development config files?
I've look at a couple of .gitignore files posted in gist.github.com and all that I've seen has bin and the config ignored.
Upvotes: 2
Views: 652
Reputation: 1326782
Both github/gitignore
and gitignore.io
agree:
bin/
(that is ClientBin/
) is ignored.
If the sources of that binary are available in the project, it can be rebuilt.
If the sources are in another git repo, your main git repo can reference them as a submodule.
If none of that is possible, the binary should be published in a artifact referential like a local Nexus repo, and referenced in the project as a dependency, declared in a pom.xml
.
config/
files are not
But if your config file has some sensitive information, then you can use a content filter driver (suing a .gitattributes
declaration).
That allows to generate on checkout the right config file from a config template with placeholders replaced by their actual value. Only that template file would be versioned, not the actual config file with potential sensitive data in it.
ge from "Customizing Git - Git Attributes", from "Pro Git book")
The smudge
script would replace the placeholder values with actual values depending on the environment (this is especially true for production values).
Those values would obviously be stored outside any git repo, in a secure location.
Upvotes: 1