Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Jimgitsit/6a2ec557bee1b3e4db06 to your computer and use it in GitHub Desktop.
Save Jimgitsit/6a2ec557bee1b3e4db06 to your computer and use it in GitHub Desktop.
Cloning and maintaining a Drupal 8 site using git
=================================================
Cloning
-------
- On your local site move the config directory sites/default/files/config_[hash]/ by creating a directory outside of the files directory where it will be version controlled ([yourdocroot]/config is as good a place as any so the final location would be [yourdocroot]/config/config_[hash]). Then change or add to settings.php:
change
$config_directories['active'] = 'sites/default/files/config_[hash]/active';
$config_directories['staging'] = 'sites/default/files/config_[hash]/staging';
to
$config_directories['active'] = 'config/config_[hash]/active';
$config_directories['staging'] = 'config/config_[hash]/staging';
(Prob won't use active. Not sure what it's use is. The active config is stored in the db anyway and we will only use staging to export and import configs).
- On local run `drush config-export staging`
- Commit local site to git.
- Clone site (or pull) on server.
- Copy settings.php from local to server (Modify as needed. It's the UUIDs or hashes that we need).
- Copy entire database from local to server.
- On server run:
`composer install`
`drush config-import staging`
`drush cache-rebuild` (`drush cc all` is deprecated)
Maintaining
-----------
- Config changes should be avoided on the server. Make config changes on local machine.
- Export config with `drush config-export staging` and commit the changes.
- Update the server with
`git pull`
`drush config-import staging`
`drush cache-rebuild`
Gotchas
-------
- Vocabulary will transfer but terms will not. This is because terms are considered content and vocabulary is configuration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment