Separating CodeIgniter config file Git for publishing publically
Create the files config.php.sample
and database.php.sample
that each of your developers will use that has a placeholder for the passwords and other sensitive information. Add config.php
and database.php
to your .gitignore
The first time you deploy to the production site, you'll create the config.php
and database.php
files. Subsequent pushes won't overwrite config.php
and database.php
since they're not included in the git repository.
Codeigniter has some support for environments (Development, Production, etc).Refer to official documentation , CodeIgniter Environments.
Regarding config files, you can use .gitignore
http://progit.org/book/ch2-2.html
Edit:Since you have used github
tag in the question; Github now has an option to add .gitignore
file (they have a codeigniter template too )
You should use a deployment tool to set the config file when deploying your application to the destination system.
capistrano
with railsless-deploy
is a good option