Via Daniel Müller:
On Mac OS X you could do:
echo no-tty >> ~/.gnupg/gpg.conf
git config --global gpg.program $(which gpg)
git config --global commit.gpgsign true
On Windows it would probably be something like this (untested):
sed -i '/^no-tty/d' ~/.gnupg/gpg.conf
git config --global --unset gpg.program
git config --global commit.gpgsign true