How to use GPG signatures with Xcode source control?

The issue here is that the default pinentry (password dialog) is terminal-based, and when you are in Xcode, Git isn't invoked with a terminal attached. Consequently, there's no way for GnuPG to prompt you for a passphrase.

The easiest way to handle this is to install the Mac pinentry with brew install pinentry-mac. You can then update your ~/.gnupg/gpg-agent.conf with pinentry-program /usr/local/bin/pinentry-mac. You may need to kill off any running gpg-agent processes so that they'll pick up the new configuration.

A rather thorough set of documentation on how to do this is available in a GitHub Gist.