Skip to main content
2 of 4
deleted 25 characters in body
Marius
  • 198.5k
  • 55
  • 424
  • 833

How to manage config.php in Magento 2

First of all it is maybe an already answered question but I did not find anything about that subject.

It is not an issue but a question about the best way to manage the file config.php in Magento 2.
Actually our config.php is not versioned (by default in M2 .gitignore file) so it is not in our repository. The problem is when someone install the project he doesn't have this file but he already have the database so he can't run bin/magento setup:install ... to generate the file.
We are aware that the bin/magento setup:upgrade add non declared modules to config.php but only if the file exists and the bin/magento module:enale can add modules but we would like to avoid to launch that every time we deploy or install the project.

My question(s) :

  • Do we have to remove config.php from .gitignore and version it ?
  • Do we have to add it the first time in the repository and let it in the .gitignore after ?
  • What is the best way to manage this file ?
Matthéo Geoffray
  • 2.7k
  • 2
  • 21
  • 45