How to copy the configuration of a Drupal 8 website

Copy configuration header

How to copy the configuration of a Drupal 8 website

In some use cases you want to copy the configuration of a Drupal 8 website into another Drupal 8 website. For example when you are working on a multisite and you want to create a copy of an existing site.

The fastest approach is to export the configuration .yml files of the first site and to import them in the new website.

An important step is to remove the UUID's in the config .yml files you export.

I made this small bash script to automate the deletion of all UUID's:

#!/bin/bash
FILES=/www/mywebsite/sites/default/config/sync/*
for f in $FILES
do
  echo "Processing $f .yml file"
  sed -i '' '/^uuid:/d' $f
done

Make sure you change the FILES variable to the path with your configuration files.

Have fun with your new Drupal 8 website!