I want to add .gitignore file to my local repo. My local repo is a clone from my Drupal 8 distro from Acquia Cloud.

What are best practices for my .gitignore file for Acquia Cloud hosted sites? I followed this tutorial.

  • For example: do i have to ignore settings.php and not settings*.php? Regarding this quote from the tutorial:

Drupal 8 You can modify .gitignore so that it ignores settings.php (not settings*.php). Then, you can update the standard settings.php with the Drupal 8 local settings file checker:

  • Where is settings.local.php for, mentioned in the Quote above from the article?

Currently my .gitignore file looks like this:

# This file contains default .gitignore rules. To use it, copy it to .gitignore,
# and it will cause files like your settings.php and user-uploaded files to be
# excluded from Git version control. This is a common strategy to avoid
# accidentally including private information in public repositories and patch
# files.
# Because .gitignore can be specific to your site, this file has a different
# name; updating Drupal core will not override your custom .gitignore file.

# Ignore core and vendor when managing dependencies with Composer.
# core
# vendor

# Ignore configuration files that may contain sensitive information.

# Ignore paths that contain user-generated content.


# Ignore SimpleTest multi-site environment.

# If you prefer to store your .gitignore file in the sites/ folder, comment
# or delete the previous settings and uncomment the following ones, instead.

# Ignore configuration files that may contain sensitive information.
# */settings*.php

# Ignore paths that contain user-generated content.
# */files
# */private

# Ignore SimpleTest multi-site environment.
# simpletest

# Ignore default text files

# ------------------------------------------------------------------------------
# SublimeText files
# ------------------------------------------------------------------------------

# Workspace settings.

# Project settings.

# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------

# Common OSX files.

# Thumbnails.

# Files that might appear in the root of a volume.

# Directories potentially created on remote AFP share.
Network Trash Folder
Temporary Items

# ------------------------------------------------------------------------------
# Windows
# ------------------------------------------------------------------------------

# Windows image file caches.

# Folder config file.

# Recycle Bin used on file shares.

# Windows Installer files.

# Windows shortcuts.

# ------------------------------------------------------------------------------
# Linux
# ------------------------------------------------------------------------------

# Tilde files.

# KDE directory preferences.

# Linux trash folder which might appear on any partition or disk.

What do i have to change to make it perfect?


Acquia Cloud provides you with a default .gitignore in your repository (as described here):


It usually is enough for the vast majority. You're however free to add anything you don't wish to keep under version control. There's no perfect setup and it really depends on what you'd like to achieve. I strongly suggest keeping settings.php under version control because it holds critical configuration for your site.

  • so you advice NOT to ignore settings.php ? But what do the mean then with this quote: 'Drupal 8 You can modify .gitignore so that it ignores settings.php (not settings*.php). Then, you can update the standard settings.php with the Drupal 8 local settings file checker:' – meez Mar 2 '16 at 13:51
  • If you are providing your own Drupal codebase to Acquia, you need to force push the settings.php the first time. You can ignore it after that. This prevents accidents from multiple collaborators or Acquia DD / VM setups from overwriting the file and committing changes to it. This setup works for me, may not be your cup of tea. – Kevin Mar 2 '16 at 14:37
  • @Kevin no i think i don't provide my own codebase to Acquia because i first cloned the repo from Acquia Cloud, so all Drupal 8 core and modules etc (like I described in my question). But i am wondering what anavarre means with his answer? – meez Mar 2 '16 at 15:45
  • I meant that I'm not in favor of ignoring settings.php from Git. On Acquia Cloud or elsewhere. It's always good to go back in time with git blame to understand who modified/added/removed any line in settings.php, thus causing regressions. It's only if you're 100% certain (can you?) settings.php will no longer be modified that you can ignore it. But I'm not sure it worth it. Looks to be working for Kevin so it really is up to you and your preferred workflow. – anavarre Mar 2 '16 at 16:08
  • @anavarre i update my question (second bullet point). Where is settings.local.php for exactly what they explain in that article? – meez Mar 2 '16 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.