Question

I'am authoring a PHP CMS, that needs an installation to work.
The installation generate a config file.

At localhost i work on an installed version (with a specific config file),
But the users who download the CMS from github would have an empty config file (= uninstalled version).

What I want :
-a specific config file (config.php) at localhost (to work on)
-an empty config file (config.php) on github (to be downloaded)

I've run across this post : Can git automatically switch between spaces and tabs?
Not sure if it's really what I'm looking for.
voila.

Was it helpful?

Solution

First, it is not recommended to store configuration files in a repository, mainly because of the reason that the configuration only applies to one environment.

This gist lists some solutions to this problem.

In your case, I would rename the empty config file to something like config.template.php, that others can copy to config.php and fill in the details. config.php is then added to the .gitignore file.

That way, the configuration files are only local, and not part of the repository.

OTHER TIPS

A common approach is to not track the config file at all in git and provide a config.php.default file (checked in). Of course you have to tell the users what to do then.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top