Prevent users from writing a file to 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 that we use with all connections to db, etc. We must stop them from copying their copy to the repository, so live is not overwritten with dev credentials. Is anyone

+3
source share
1 answer

You can lock the file. This will not stop someone from changing it (since they can break the lock), but it provides an additional barrier that is often enough to stop registration.

A better solution would be to write a pre-commit hook that rejects server-side registration; however, it would be very unpleasant to get people to check everything except the forbidden file, as this would mean listing a large number of files on the command line (or the gui tool).

The best solution is not to check the file, but to check the "config template" file with a similar but different name from the required one. Inside this file, you explain the need to copy the file to the correct file name (and describe which fields need to be filled in with the appropriate information). Then you add the svn ignore property for the actual configuration file. Again, someone tricky enough can cancel the ignore and check the file in the end, but it's often enough to stop everything except the most demanding system switches.

+6
source

Source: https://habr.com/ru/post/1778842/


All Articles