防止在SVN中提交web.config [英] Prevent web.config from being committed in SVN

查看:146
本文介绍了防止在SVN中提交web.config的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以防止在执行SVN提交时提交web.config文件?我设置了以下SVN全局忽略模式,但仍然不能阻止它。如果我将 * .config替换为 web.config,它仍然不会阻止它。

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

全局忽略模式:

*.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

==================

=====================

右键单击Web.config文件,然后选择删除并添加到忽略列表。文件上的图标将变为红色的 X。然后提交更改。它不会删除物理文件,但是会从SVN中删除它,因此不再提交。

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.

推荐答案

全局忽略实际上是针对您不想在存储库中使用的文件类型的,因此您不会 偶然 添加它们。这就是为什么它们都是后缀。另外,它们仅在一台计算机上本地运行,因此无法真正执行它。您可以在每个目录中设置 svn:ignore ,并且可以将其设置为特定您不需要添加的文件或目录。

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.

忽略和 svn:ignore 仅适用于不添加的文件或目录。尚未在存储库中,因此如果web.config已经存在,则不能使用它们。而且,它们并不会阻止您有目的地指定您要在存储库中使用该文件。基本上,全局忽略的文件不会显示带有?当您执行 svn状态时,如果您进行 svn添加* ,则不会添加。但是,您始终可以执行 svn添加web.config 并将其添加到存储库中。

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.

如果您真的想确保从未添加过它,可以使用我预先提交的 Kitchen Sink挂钩。该挂钩脚本执行许多不同的任务,并且它可以做的一件事就是允许您基于Glob或Regex模式禁止文件。如果有人使用 svn添加web.config 并尝试提交,则该预提交挂钩将禁止该交易。

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.

我最近重写了该脚本,您可以下载它并尝试一下。您将需要Perl,但是我编写的脚本不需要任何可选模块,因此安装非常简单。如果您使用的是Unix系统,那么Perl的5.8版本应该可以正常工作。在Windows上,您可以下载ActiveState Perl或Strawberry Perl,并且预提交的钩子将正常运行。

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.

我使用钩子脚本来防止用户添加所有各种VisualStudio用户文件,或bin / obj和bin / release目录。我还防止有人在/ target目录中添加。它还可以用于允许用户创建标签,但禁止对其进行任何编辑。

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.

这篇关于防止在SVN中提交web.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆