To take full advantage of Drupal’s configuration management, however, there’s another change we should make. By default Drupal doesn’t assume it can write files anywhere outside the site’s files folder, but by design any files in this directory will be excluded from the git repo. You can still copy them between environments using drush commands, the Acquia CLI, or the Acquia Cloud UI, but doing so means you lose the ability to track changes, maintain version control on the configuration, and easily roll back changes when needed.
Let’s get Drupal to export the configuration files in a location where they will be tracked by git. We could just update the application’s .gitignore file to force the directory to be tracked, or force the directory to be tracked by git on the command line, but it would be better to have these files outside the web root anyway, so let’s give Drupal that direction, in the site’s settings.php file. On the left hand side, open the Project pane to show your files, and navigate to docroot/sites/default and click on settings.php to open it in the IDE’s editor.
Change the last line of the file, where it sets the value for $settings['config_sync_directory'] to use a value of '../config/sync'. If the file won’t save, in the terminal go to docroot/sites/default and run
chmod 0644 settings.php and then save the file. After the change has been saved, revert the permissions with
chmod 0444 settings.php.
In the terminal you can now use
drush cex to export the configuration to code whenever you’re ready to sync configuration changes to another environment. It’s a good idea to do that now, so our code repo will have a snapshot of the initial configuration.