简体   繁体   中英

Prevent users from committing a file in SVN

I know...SVN. But here is the deal. I have several developers (and some designers) working in SVN. We have a configure.php file we use with all db connections, etc. We need to prevent them from committing their copy to the repository so live doesnt get overwritten to dev credentials. Anyone?

You can lock the file. It won't really stop someone from modifying it (as they can break the lock), but it provides an extra barrier which is often enough to stop the check-in.

A better solution would be to write a pre-commit hook rejecting the check-in on the server side; however, it would be very annoying to force people to check in everything except the forbidden file, as that would mean listing a lot of files on the command line (or gui tool).

The best solution is to not check in the file, but to check in a "config template" file with a similar, but different name from the one needed. Inside that file you explain the need to copy the file to the correct file name (and describe which fields need filled out with the appropriate information). Then you add a svn ignore property for the actual configuration file. Again someone crafty enough can unset the ignore and check in the file eventually, but it's often enough to stop all but the most diligent system breakers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM