.gitignore pour Drupal

49 règles d’exclusion pour Drupal, prêtes à copier dans votre dépôt.

Framework de gestion de contenu

Le .gitignore complet pour Drupal

# Generated by LFGitignore - https://lfgitignore.com
# Created: 2026-08-05 01:28:10 UTC
# Technologies: Drupal

### Drupal ###
/web/sites/*/*settings*.php
/web/sites/*/*services*.yml
/web/sites/*/files
/web/sites/*/public
/web/sites/*/private
/web/sites/*/files-public
/web/sites/*/files-private
/web/sites/*/translations
/web/sites/*/tmp
/web/sites/*/cache
/web/vendor
/web/core
/web/modules/README.txt
/web/modules/contrib
/web/profiles/README.txt
/web/profiles/contrib
/web/sites/development.services.yml
/web/sites/example.settings.local.php
/web/sites/example.sites.php
/web/sites/README.txt
/web/themes/README.txt
/web/themes/contrib
/web/.csslintrc
/web/.editorconfig
/web/.eslintignore
/web/.eslintrc.json
/web/.gitattributes
/web/.htaccess
/web/.ht.router.php
/web/autoload.php
/web/composer.json
/web/composer.lock
/web/example.gitignore
/web/index.php
/web/INSTALL.txt
/web/LICENSE.txt
/web/README.txt
/web/robots.txt
/web/update.php
/web/web.config
/vendor
/composer.phar
/composer
/robo.phar
/robo
/drush.phar
/drush
/drupal.phar
/drupal

Ce que ces règles Drupal ignorent vraiment

Chaque motif ci-dessous, et pourquoi il a sa place dans votre .gitignore.

Ignore configuration files that may contain sensitive information

Motif Ce qu’il ignore
/web/sites/*/*settings*.php Ignore configuration files that may contain sensitive information
/web/sites/*/*services*.yml Ignore configuration files that may contain sensitive information

Ignore paths that may contain user-generated content

Motif Ce qu’il ignore
/web/sites/*/files Ignore paths that may contain user-generated content
/web/sites/*/public Ignore paths that may contain user-generated content
/web/sites/*/private Ignore paths that may contain user-generated content
/web/sites/*/files-public Ignore paths that may contain user-generated content
/web/sites/*/files-private Ignore paths that may contain user-generated content

Ignore paths that may contain temporary files

Motif Ce qu’il ignore
/web/sites/*/translations Ignore paths that may contain temporary files
/web/sites/*/tmp Ignore paths that may contain temporary files
/web/sites/*/cache Ignore paths that may contain temporary files

Ignore drupal core (if not versioning drupal sources)

Motif Ce qu’il ignore
/web/vendor Ignore drupal core (if not versioning drupal sources)
/web/core Ignore drupal core (if not versioning drupal sources)
/web/modules/README.txt Ignore drupal core (if not versioning drupal sources)
/web/modules/contrib Ignore drupal core (if not versioning drupal sources)
/web/profiles/README.txt Ignore drupal core (if not versioning drupal sources)
/web/profiles/contrib Ignore drupal core (if not versioning drupal sources)
/web/sites/development.services.yml Ignore drupal core (if not versioning drupal sources)
/web/sites/example.settings.local.php Ignore drupal core (if not versioning drupal sources)
/web/sites/example.sites.php Ignore drupal core (if not versioning drupal sources)
/web/sites/README.txt Ignore drupal core (if not versioning drupal sources)
/web/themes/README.txt Ignore drupal core (if not versioning drupal sources)
/web/themes/contrib Ignore drupal core (if not versioning drupal sources)
/web/.csslintrc Ignore drupal core (if not versioning drupal sources)
/web/.editorconfig Ignore drupal core (if not versioning drupal sources)
/web/.eslintignore Ignore drupal core (if not versioning drupal sources)
/web/.eslintrc.json Ignore drupal core (if not versioning drupal sources)
/web/.gitattributes Ignore drupal core (if not versioning drupal sources)
/web/.htaccess Ignore drupal core (if not versioning drupal sources)
/web/.ht.router.php Ignore drupal core (if not versioning drupal sources)
/web/autoload.php Ignore drupal core (if not versioning drupal sources)
/web/composer.json Ignore drupal core (if not versioning drupal sources)
/web/composer.lock Ignore drupal core (if not versioning drupal sources)
/web/example.gitignore Ignore drupal core (if not versioning drupal sources)
/web/index.php Ignore drupal core (if not versioning drupal sources)
/web/INSTALL.txt Ignore drupal core (if not versioning drupal sources)
/web/LICENSE.txt Ignore drupal core (if not versioning drupal sources)
/web/README.txt Ignore drupal core (if not versioning drupal sources)
/web/robots.txt Ignore drupal core (if not versioning drupal sources)
/web/update.php Ignore drupal core (if not versioning drupal sources)
/web/web.config Ignore drupal core (if not versioning drupal sources)

Ignore vendor dependencies and scripts

Motif Ce qu’il ignore
/vendor Ignore vendor dependencies and scripts
/composer.phar Ignore vendor dependencies and scripts
/composer Ignore vendor dependencies and scripts
/robo.phar Ignore vendor dependencies and scripts
/robo Ignore vendor dependencies and scripts
/drush.phar Ignore vendor dependencies and scripts
/drush Ignore vendor dependencies and scripts
/drupal.phar Ignore vendor dependencies and scripts
/drupal Ignore vendor dependencies and scripts

Comment utiliser ce .gitignore pour Drupal

  1. Copiez les règles Drupal ci-dessus, ou téléchargez directement le fichier.
  2. Créez un fichier nommé .gitignore à la racine de votre dépôt Git et collez-y les règles.
  3. Si certains de ces fichiers sont déjà suivis, lancez git rm -r --cached . puis recommitez — Git n’applique les règles d’exclusion qu’aux fichiers non suivis.
  4. Commitez le .gitignore pour que toute l’équipe partage les mêmes règles.

Autres modèles .gitignore CMS

Voir tous les modèles CMS