Change .gitignore file for sites/default/files/config I'm checking out the new configuration management module for Drupal 7. It's effectively a back-port of the new configuration management that's in D8, and looks like it's going to be a great alternative to the use of Features for storing configuration.

https://drupal.org/project/configuration

I have a test github repository where I'm playing with the module. I'd like to put my code and configuration in this repo, and I'd quite like to keep the default location for the config files (sites/default/files/config).

I realise that this is more a question about .gitignore files than Drupal. However, how can I change my .gitignore file so that I can add the config files to my repo?

The current gitignore is here. (This is the excellent .gitignore file provided by github as a default for Drupal projects).

The simple change of adding !sites/default/files/config/* to the end of the file doesn't seem to help.

EDIT: I also tried this, with no luck:

!sites/default/files/config/*.inc


I'd be grateful for any tips on how others manage to solve this problem. Thanks!
You can do that if you ignore the content in "sites//files/" directory and not the directory itself "sites/*/files/", I think this is not the best way to do it but that is what I have managed to find.

Ignore all the content in "sites//files/" except for the config directory

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


or you can only ignore the config/*.inc

# Ignore paths that contain user-generated content.
sites/*/private
sites/*/files/*
!sites/*/files/config
sites/*/files/config/*
!sites/*/files/config/*.inc


remember to replace the default "sites//files" with "sites//files/*" in the .gitigonre file.



Another way is to forcefully add the files you want to commit, this will add the files in the directory and track there changes,  but will not detect new files added in the future.

git add -f default/files/config/