I found this at a blog to grep project and submodules:
[alias]
sgrep = \"!f() { git grep \\\"$1\\\"; git submodule foreach \\\"git grep \'$1\'; true\\\" |
Generally, similar to "GitConfig: bad config for shell command", it may be because the '\
' character is interpreted by git first, before being executed in a shell.
But in your case, this should work as expected because of the surrounding double-quotes.
It does work on my git 1.8.4 on Ubuntu.
So simplify your .gitconfig
and check if works better if it contains your alias (and nothing) else.
If that does work, then the issue is elsewhere in your config file.