Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use GPG signatures with Xcode source control?

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.

like image 741
Florrie Avatar asked Sep 06 '16 13:09

Florrie


People also ask

How to Add remote origin in Xcode?

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.

What is source control in Xcode?

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.

How to Push changes from Xcode?

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.


1 Answers

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.

like image 167
bk2204 Avatar answered Nov 15 '22 21:11

bk2204