Is it possible to prevent the web.config file from being committed when doing an SVN commit? I have the following SVN Global ignore pattern set, but it still doesn't prevent it. If I replace "*.config" with "web.config" it still doesn't prevent it.
http://screencast.com/t/fLKoZhYykYG
Global ignore pattern:
*.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo *.rej *~ #*# .#* .*.swp .DS_Store */bin */obj bin obj aspnet_client *.tmp */legacy legacy *.suo *.user *.config
=====================
Simple Answer (even though the utility below is very good):
Right click the Web.config file, and choose "Delete and Add to Ignore List". The icon on the file will turn into a red "X". Then commit the change. It will not delete the physical file, but it'll delete it from SVN so it won't commit anymore.
The Global ignore is really for file types you don't want in your repository, so you don't accidentally add them. That's why they're all suffixes. Plus, they're only local for that one machine, so there's no way to really enforce it.You can set svn:ignore
in each directory and that can be set to specific files or directories you don't to add.
Ignores and svn:ignore
only work for files that aren't already in your repository, so you can't use them if web.config is already there. And, they don't stop you from purposefully specifying that you want that file in your repository. Basically, a globally ignored file won't show up with a ? when you do svn status
and won't be added if you do a svn add *
. However, you can always do a svn add web.config
and it'll be added to your repository.
If you really want to make sure it is never added, you can use my pre-commit "Kitchen Sink" hook. This hook script does a lot of different tasks, and one thing it can do is to allow you to ban files based upon Glob or Regex patterns. If someone does an svn add web.config
, and tries to commit it, this pre-commit hook will prohibit the transaction.
I've recently rewrote the script, and you can download it and give it a try. You'll need Perl, but I've written the script not to require any optional modules, so installation is pretty simple. If you're on a Unix system, Perl as old as 5.8 should work fine. On Windows, you can download ActiveState Perl or Strawberry Perl and the pre-commit hook will run with no problems.
I use the hook script to prevent users from adding in all the various VisualStudio user files, or the bin/obj and bin/release directories. I also prevent someone adding in a /target directory. It also can be used to allow users to create a tag, but prevent any editing of them.
Right click the Web.config file, and choose "Delete and Add to Ignore List". The icon on the file will turn into a red "X". Then commit the change. It will not delete the physical file, but it'll delete it from SVN so it won't commit anymore.