To get basic error messages in Drupal 8 you don't need to touch any code at all. Just go to:
/admin/config/development/logging
and set "Error Messages to Display" to an appropriate level.
You can also view your recent errors through the admin interface:
/admin/reports/dblog
That said, other answers about settings files are relevant – you should only ever make errors visible on your development site, not production.
Overwritten $config objects/keys in settings.php won't be written to the sync directory when exporting, so providing your settings.php is in .gitignore, you can continue to safely use the configuration system to sync between clones of the same site.