About the Magento config, environment & version control
The app/etc
folder contains two main files that you’ll deal with all the time. The config.php
file controls app-specific configuration, such as which modules are enabled. This configuration file will be shared among all of your environments, so it should be added to your version control systems. Any update to this file should affect every related Magento server environment.
The env.php
file controls environment-specific configuration, such as connection credentials for the many related database services, and anything relating to a specific server environment. Because these are environment-specific and you’ll have different values in this file for each one of your environments, you should not add this file to your version control system.
Magento does supply a base .gitignore
file for you to use. However, for some reason Magento’s .gitignore
file contains app/etc/config.php
, but it shouldn’t. If yours does, be sure to remove it from this .gitignore
file, and add this config.php
file to your version control system.
All other updates, such as ignoring the contents of var
and vendor
directories should be valid, as these are ephemeral artifacts that either shouldn’t persist or be stored in version control systems, like var
, or should be installed during a deployment process, such as vendor
.