Because doing so you make a difference between your local (often "dev") and distant configuration. This also allow you to protect your private datas without forgetting to set a required parameter.
For example, symfony has a "parameters.yml" file, and a "parameters.yml.dist" file. Your parameters contains real data, used for your actual environnment and is never commited if you respect good practices, because you would then push a file containing your database name, username, your mail host, and all kind of absolutely sensitive datas (secret token used in forms aswell).
So, you have a dist file, containing the same key, but without value :
Example :
parameters.yml :
# This file is auto-generated during the composer install
parameters:
database_host: mysql
database_port: null
database_name: portfolio
database_user: artandor
database_password: supersecretpassword
mailer_transport: smtp
mailer_host: smtp.gmail.com
mailer_user: artandor
mailer_password: supersecretaswell
secret: 070950937b085d66fb1c59978ab9c47d4a420e32
and your dist file would look like :
# This file is a "template" of what your parameters.yml file should look like
# Set parameters here that may be different on each deployment target of the app, e.g. development, staging, production.
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
parameters:
database_host: 127.0.0.1
database_port: ~
database_name: symfony
database_user: root
database_password: ~
# You should uncomment this if you want to use pdo_sqlite
#database_path: '%kernel.project_dir%/var/data/data.sqlite'
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: ~
mailer_password: ~
# A secret key that's used to generate certain security-related tokens
secret: ThisTokenIsNotSoSecretChangeIt
Sorry for long post, wanted to make it clear for you :)
Usual process is pushing dist file, then once you pulled it on your server, make
cp parameters.yml.dist parameters.yml
Other reason than securing datas, would be to have a different config between local and deployed application.
Bye :)