.gitignore for Drupal 7
32 ignore rules for Drupal 7, ready to copy into your repository.
Drupal version 7
The complete .gitignore for Drupal 7
# Generated by LFGitignore - https://lfgitignore.com
# Created: 2026-08-05 01:29:57 UTC
# Technologies: Drupal 7
### Drupal 7 ###
sites/*/*settings*.php
sites/example.sites.php
files/
sites/*/files
sites/*/private
sites/*/translations
robots.txt
/CHANGELOG.txt
/COPYRIGHT.txt
/INSTALL*.txt
/LICENSE.txt
/MAINTAINERS.txt
/UPGRADE.txt
/README.txt
sites/README.txt
sites/all/libraries/README.txt
sites/all/modules/README.txt
sites/all/themes/README.txt
.htaccess
web.config
authorize.php
cron.php
index.php
install.php
update.php
xmlrpc.php
/includes
/misc
/modules
/profiles
/scripts
/themes
What these Drupal 7 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 |
|---|---|
sites/*/*settings*.php |
Ignore configuration files that may contain sensitive information. |
sites/example.sites.php |
Ignore configuration files that may contain sensitive information. |
Ignore paths that contain generated content.
| Pattern | What it ignores |
|---|---|
files/ |
Ignore paths that contain generated content. |
sites/*/files |
Ignore paths that contain generated content. |
sites/*/private |
Ignore paths that contain generated content. |
sites/*/translations |
Ignore paths that contain generated content. |
Ignore default text files
| Pattern | What it ignores |
|---|---|
robots.txt |
Ignore default text files |
/CHANGELOG.txt |
Ignore default text files |
/COPYRIGHT.txt |
Ignore default text files |
/INSTALL*.txt |
Ignore default text files |
/LICENSE.txt |
Ignore default text files |
/MAINTAINERS.txt |
Ignore default text files |
/UPGRADE.txt |
Ignore default text files |
/README.txt |
Ignore default text files |
sites/README.txt |
Ignore default text files |
sites/all/libraries/README.txt |
Ignore default text files |
sites/all/modules/README.txt |
Ignore default text files |
sites/all/themes/README.txt |
Ignore default text files |
Ignore everything but the "sites" folder ( for non core developer )
| Pattern | What it ignores |
|---|---|
.htaccess |
Ignore everything but the "sites" folder ( for non core developer ) |
web.config |
Ignore everything but the "sites" folder ( for non core developer ) |
authorize.php |
Ignore everything but the "sites" folder ( for non core developer ) |
cron.php |
Ignore everything but the "sites" folder ( for non core developer ) |
index.php |
Ignore everything but the "sites" folder ( for non core developer ) |
install.php |
Ignore everything but the "sites" folder ( for non core developer ) |
update.php |
Ignore everything but the "sites" folder ( for non core developer ) |
xmlrpc.php |
Ignore everything but the "sites" folder ( for non core developer ) |
/includes |
Ignore everything but the "sites" folder ( for non core developer ) |
/misc |
Ignore everything but the "sites" folder ( for non core developer ) |
/modules |
Ignore everything but the "sites" folder ( for non core developer ) |
/profiles |
Ignore everything but the "sites" folder ( for non core developer ) |
/scripts |
Ignore everything but the "sites" folder ( for non core developer ) |
/themes |
Ignore everything but the "sites" folder ( for non core developer ) |
How to use this .gitignore for Drupal 7
- Copy the Drupal 7 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.