Change .gitignore file for sites/default/files/config
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/