cancel
Showing results for 
Search instead for 
Did you mean: 

Should i add app/etc/config.php to GIT?

Should i add app/etc/config.php to GIT?

hi everybody,

i'm sorry if this question is dump or not in right board.

 

as i check in this docs: 

https://devdocs.magento.com/guides/v2.2/config-guide/deployment/pipeline/

 

The shared configuration file, app/etc/config.php, should be included in source control

 i did add this file to our source control(git), but everytime team member run setup:upgrade on their local, magento generate a new content for that file(just module order changed). Then git recognize there is a new update. 

 

I already used:

git update-index --assume-unchanged app/etc/config.php

It's ok when i add all file to git, that config doesn't add to git. But when i checkout to another branch, git told me need to discard changes on that file first.

The reason why i add config.php to GIT is i want to control some configs like: Enable/Disable merge css js, change store's locale. I push config in file config.php like this:

'websites' => [
      'en' => [
        'dev' => [
          'js' => [
            'merge_files' => '0',
            'enable_js_bundling' => '0',
            'minify_files' => '1'
          ],
          'css' => [
            'merge_css_files' => '0',
            'minify_files' => '1'
          ]
        ]
      ]
    ]

My questions are:
1. Is managing config in file config.php a correct way?
2. if yes, how can i get rid of git issue?

 

Thank you Smiley Happy

 

 

 

 

4 REPLIES 4

Re: Should i add app/etc/config.php to GIT?

Hi @chip_hyt_chip 

 

I understand the problem you are facing  !

 

RE : Is managing config in file config.php a correct way?

 

- Based on my experience i would say all the configuration related information will be managed in config.php file only and based on magento 's standard yes you will require to add that config.php file in source control (git)

 

 


2. if yes, how can i get rid of git?

 

- In regards to this , i would say - create a one global config.php file and add all the configurations you want on the server add those into the config.php file and commit on git.

 

Now on the developer 's system ask developers to put this config.php file as an git ignore same like database file, so when they run setup:upgrade command and few changes occurs in config.php file then also it will not showcasing in git - as this is added in git ignore.

 

So you will not able to see those changes on git.

 

Hope it helps and let me know if your question meant something else Smiley Happy

if issue solved,Click Kudos & Accept as Solution

Re: Should i add app/etc/config.php to GIT?

thank you @Manthan Dave.

 

create a one global config.php file.

you mean i need to create new file like: config-global.php?

 

> So you will not able to see those changes on git.

as i known, once file added to git, we can not ignore it, adding to .gitignore doesn't work. I already tried before.

 

 

 

Re: Should i add app/etc/config.php to GIT?


Now on the developer 's system ask developers to put this config.php file as an git ignore same like database file

Source? I've found that it was on .gitignore prior 2.2, than removed, now added to gitignore again and want to understand the why

Re: Should i add app/etc/config.php to GIT?

Simple answers to your questions:

 

* Yes, app/etc/config.php should be in git control

* If your developers running setup:upgrade results in different order of modules within the file, it means that such developers are using Windows for development. Such developers should not be dealt with. Good developers all use *NIX systems.