.gitignore for Drupal
49 ignore rules for Drupal, ready to copy into your repository.
Content management framework
The complete .gitignore for 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
What these Drupal rules actually ignore
Every pattern below, and why it belongs in your .gitignore.
Ignore configuration files that may contain sensitive information
| Pattern | What it ignores |
|---|---|
/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
| Pattern | What it ignores |
|---|---|
/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
| Pattern | What it ignores |
|---|---|
/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)
| Pattern | What it ignores |
|---|---|
/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
| Pattern | What it ignores |
|---|---|
/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 |
How to use this .gitignore for Drupal
- Copy the Drupal rules above, or download the file directly.
- Create a file named .gitignore at the root of your Git repository and paste the rules into it.
- If some of those files are already tracked, run git rm -r --cached . then commit again — Git only applies ignore rules to untracked files.
- Commit the .gitignore so everyone on the team shares the same rules.