Yii2 advance with Git

Hi All,

I am setting up New Project. After initial setup and changing database connection and all thing in ./common/config/main-local.php

I have pushed my code in git. Since this main-local.php and params-local.php files are in ./common/config/.gitignore I would i like to know how do others will get any changes in make in such files. How will i push project to production… will i need to make all changes in main.php and params.php files as well.

Pl revert…

Thanks in advance


That the "local" files are not uploaded is a wanted behaviour.

Explained here at "Configuration and environments":


Maybe this helps you for better understanding regarding configs and how to switch them:



Thanks for the quick response.


why is vendor directory present in .gitignore file.

I believe vendor dir has framework folder (yiisoft) in it.

Does this mean vendor folder needs to be deployed separately?

Thanks in advance


Because all you need is mentioned in your "composer.json".

You usually use composer to install everything that is located in your vendor directory. So including the whole vendor directory in every GIT project would make no sense… usually, with a correct composer.json you can simly:

  1. Download your project from git.

  2. Go to your projectfolder.

  3. Execute command: composer update

  4. All required framework files / extensions etc will be downloaded and installed.

If you don’t have experience with composer yet, start reading about it.

You will see / understand the benefits quickly.