Drupal - How can I import the configuration on a different site?

You can get the UUID with:

drush config-get "system.site" uuid

And you can change it with

drush config-set "system.site" uuid "fjfj34-e3bb-2ab8-4d21-9100-b5etgetgd99d5"

With that you gotta have the same sites.


The Configuration Management only allow sync configuration between same site or project to avoid issues importing configuration from site a.com to b.com, to accomplish this validation Drupal 8 generate a UUID for each site.

You cat get your current site UUID executing the following command:

drush cget system.site

The command above we will have a similar output to next listing:

uuid: 236fa77c-d83e-42de-8a03-03c574c00160
name: Drupal 8
mail: [email protected]
slogan: ''
page:
  403: ''
  404: ''
  front: node
admin_compact_mode: false
weight_select_max: 100
langcode: en

The config import has a different UUID, you can confirm the UUID with the following command

cat sites/default/config/staging/system.site.yml

For that reason you need to change the value of Site UUID using the following Drush command:

drush cedit system.site

The command above enable you to use your favorite text editor to set the same UUID present in staging config files.

cat sites/default/config/staging/system.site.yml

After change the UUID and change the permissions, if you visit again the page example.com/admin/config/development/configuration you will see all changes, deletions, renames, and additions.

source: http://enzolutions.com/articles/2014/08/27/understanding-configuration-management-in-drupal-8/


Using Drupal Console

You can override your current site's uuid with the uuid value present in the configuration you want to import.

You can achieve this with Drupal Console by overriding the system.siteuuid key.

$ drupal config:override

Then enter the configuration name system.site, the configuration key uuid and the appropriate value when prompted.

Enter configuration name [advagg.settings]:
> system.site

Enter the configuration key [uuid]:
> uuid

Enter the configuration value:
> 656165f1-1017-45a1-9bd8-f70e31cf29ab

Configuration name system.site
------------------- -------------------------------------- -------------------------------------- 
Configuration key   Original Value                         Override Value                        
------------------- -------------------------------------- -------------------------------------- 
uuid                7622bb19-5f3f-452d-82a3-c0a88241e789   656165f1-1017-45a1-9bd8-f70e31cf29ab  
------------------- -------------------------------------- --------------------------------------