Reputation: 14316
I'm using GIT repository for my project. In my web.config I have a debug connection string to my local SQL server database. It won't work for anyone else. I cannot just put entire Web.config in .gitignore - the project wouldn't even compile.
A perfect solution would be to put the connection string in a separate file and make Web.config load it. Is it possible?
If not, is there any other solution? (using sql server CE won't work, because it breaks code first migrations)
Upvotes: 15
Views: 4245
Reputation: 43
add it to gitignore file by right click inside git folder or we can get it from https://help.github.com/articles/ignoring-files/
Upvotes: 0
Reputation: 887797
You can move a single section of Web.config to a separate file.
In Web.config, write
<connectionStrings configSource="connectionStrings.config" />
Then, move the original element to a separate connectionStrings.config
(or any other filename) and add it to gitignore.
Upvotes: 27