My .gitignore in the drupal root is as follows:

# Ignore configuration files that may contain sensitive information.

# Ignore paths that contain generated content.

When I pushed it to a repository on github, the sites/default folder did not get pushed.

How to solve the issue?

  • Did you add any file under sites/default? If you ignore settings.php and files, what else was added under there? Empty folders for example won't be added. Try adding default.settings.php and then push. Jun 19, 2014 at 7:22
  • I did a git add -A This should have added the default.settings.php by itself as it is not in .gitignore Jun 19, 2014 at 7:23
  • try git add sites/default/default.settings.php then git will tell you if the file is excluded by your.gitignore file. Jun 19, 2014 at 7:24
  • Output: The following paths are ignored by one of your .gitignore files: sites/default/default.settings.php Use -f if you really want to add them. fatal: no files added Jun 19, 2014 at 7:26
  • oh! i think sites/*/*settings*.php is the issue. the * before settings Jun 19, 2014 at 7:27

1 Answer 1


I would add a README file under sites/default/files then force the file to be added to the repository by executing git add -f sites/default/files/README and push your files.

The -f flag will allow the file to be added by overriding your .gitignore file. The next time you clone the repository on a new location the folder sites/default and sites/default/files will be created by git.

When downloading Drupal the sites/default folder contains a file called default.settings.php. And one solution here would have been to add that file. But since your .gitignore excludes sites/*/settings.php default.settings.php file wont be added and Git will not add empty folders to the repository.

  • yes! removing the * before settings in sites/*/*settings*.php in the .gitignore file will solve the issue. Jun 19, 2014 at 8:07

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.