tags:

views:

94

answers:

2
+2  Q: 

SVN Private File

I have a web-based application that I would like to open source by using a public svn host, the problem is that the project contains configuration files which I would rather keep some of the values private. What is the best way of handling this?

Ideally I would like to be able to import revisions without having to replace the file with a file stripped of private data every time.

+4  A: 

User specific configuration files should not be part of the source of a FOSS project. If you want to version control them, keep them in a separate, private repository.

anon
Why? You might have a file file a sample set of users with passwords or DB credentials for testing purpose.
cimnine
In which case it is not user specific - I didn't say configuration files should not be part of the project.
anon
+6  A: 

Maintain two configuration files:

  • One named, say, config.php
  • Another named config.dist.php

config.php is your live settings file where you store your runtime configuration with private data, paths and such.

config.dist.php is the same file but with default or dummy configuration settings.

Whenever your project gets a new configuration setting, you test it in your live config.php file and afterwards copy it into the .dist file, giving it a dummy value.

Set your version control to ignore config.php.

That way, you will never have private data in your repository, but somebody checking out the project has a default configuration file to start right away.

Pekka