Whenever I try to commit my files, I get this error message:
gpg: cannot open `/dev/tty': Device not configured
error: gpg failed to sign the data
fatal: failed to write commit object
Yikes! This is because I have GPG signatures enabled for git.
Is it possible to use GPG signatures with Xcode repositories?
It's not a huge deal, as it's easy enough to disable GPG signatures (git config commit.gpgsign true
), but it's a rather nice identification to have.
Go to Source Control in Xcode and select Projectname -- master, then Configure... In the Address field, paste the Git clone URL for your repo copied in the previous step. Select Add Remote, then select Done to finish creating the origin remote for your local Git repo.
Overview. Source control is the practice of tracking and managing changes to your code. Manage your Xcode project with source control to keep a rich history of the changes you make, and collaborate on code faster and more effectively. Xcode simplifies source control management with its built-in support for Git.
Share changes to a remote repository When you're ready to share your work, choose Source Control > Push. In the dialog that appears, select the branch you want to share, select the Include Tags option if you want to push tags to the remote repository, and then click Push to sync your changes with the remote repository.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With