{"thread":{"id":"52299","subject":"Commit signing and pinentry problems","startedAt":"2019-11-20T12:42:48Z","lastAt":"2020-03-02T14:10:35Z","messageCount":4,"participants":["Jeffrey Walton","Randall S. Becker","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"386637","messageId":"CAH8yC8n+ta4BSAE4rEfhKxe3T9poVdc94HvSk=6PEA4YbmwVyA@mail.gmail.com","threadId":"52299","inReplyTo":null,"subject":"Commit signing and pinentry problems","fromName":"Jeffrey Walton","fromEmail":"noloader@gmail.com","sentAt":"2019-11-20T12:41:23Z","receivedAt":"2019-11-20T12:42:48Z","isPatch":false,"sender":{"key":"noloader@gmail.com","avatar":null},"body":"Hi Everyone,\n\nI'm having an annoying problem that I can't figure out. I hope Git has\na setting to fix it.\n\nI have a desktop workstation where I sit at the keyboard about 1/3 of\nthe time. Git signing works as expected. About 2/3 of the time I SSH\ninto the machine. Git signing does not work when SSH'd in.\n\nWhen Git signing fails over SSH an error looks like:\n\n   $ git commit -S log.h -m \"Remove unneeded header\"\n   error: gpg failed to sign the data\n   fatal: failed to write commit object\n\nI just noticed this today (but it makes sense)...\n\n    - Go to desktop workstation, log in\n    - Go to remote machine, log in\n    - Sign at remote machine over SSH\n      - Desktop workstation will open GUI password prompt\n      - Remote machine sign operation will hang until GUI prompt times-out\n\nThe problem was reported to Ubuntu but no activity:\nhttps://bugs.launchpad.net/ubuntu/+source/pinentry/+bug/1852696 .\n\nDoes anyone know how to use Git to work around pinentry brain-dead-ness?\n\nThanks in advance.\n"},{"id":"386643","messageId":"02c601d59fb5$60dfbbf0$229f33d0$@nexbridge.com","threadId":"52299","inReplyTo":"CAH8yC8n+ta4BSAE4rEfhKxe3T9poVdc94HvSk=6PEA4YbmwVyA@mail.gmail.com","subject":"RE: Commit signing and pinentry problems","fromName":"Randall S. Becker","fromEmail":"rsbecker@nexbridge.com","sentAt":"2019-11-20T15:15:38Z","receivedAt":"2019-11-20T15:15:48Z","isPatch":false,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"On November 20, 2019 7:41 AM, Jeffrey Walton wrote:\n> I'm having an annoying problem that I can't figure out. I hope Git has a\n> setting to fix it.\n> \n> I have a desktop workstation where I sit at the keyboard about 1/3 of the\n> time. Git signing works as expected. About 2/3 of the time I SSH into the\n> machine. Git signing does not work when SSH'd in.\n> \n> When Git signing fails over SSH an error looks like:\n> \n>    $ git commit -S log.h -m \"Remove unneeded header\"\n>    error: gpg failed to sign the data\n>    fatal: failed to write commit object\n> \n> I just noticed this today (but it makes sense)...\n> \n>     - Go to desktop workstation, log in\n>     - Go to remote machine, log in\n>     - Sign at remote machine over SSH\n>       - Desktop workstation will open GUI password prompt\n>       - Remote machine sign operation will hang until GUI prompt times-out\n> \n> The problem was reported to Ubuntu but no activity:\n> https://bugs.launchpad.net/ubuntu/+source/pinentry/+bug/1852696 .\n\nI would refer you to the GnuPG project lists for answers to this issue. However, AFAIK, gpg requires a real terminal from which to obtain a password with the intent of not allowing malicious code to capture the password by a man-in-the-middle attack. Depending on the platform, stdin is not acceptable. Check the GnuPG project common/ttyio.c module. It may be that your setup is not providing an apparent terminal so the prompt may actually be happening elsewhere than where you expect. I have had a similar issue with Jenkins when not running fully headless, and the password prompt was on the tty where Jenkins was started. This is unlikely a \"hang\" per se.\n\nGood luck,\nRandall\n\n\n"},{"id":"386693","messageId":"20191121004831.GB6430@camp.crustytoothpaste.net","threadId":"52299","inReplyTo":"CAH8yC8n+ta4BSAE4rEfhKxe3T9poVdc94HvSk=6PEA4YbmwVyA@mail.gmail.com","subject":"Re: Commit signing and pinentry problems","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2019-11-21T00:48:31Z","receivedAt":"2019-11-21T00:48:42Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2019-11-20 at 12:41:23, Jeffrey Walton wrote:\n> Hi Everyone,\n> \n> I'm having an annoying problem that I can't figure out. I hope Git has\n> a setting to fix it.\n> \n> I have a desktop workstation where I sit at the keyboard about 1/3 of\n> the time. Git signing works as expected. About 2/3 of the time I SSH\n> into the machine. Git signing does not work when SSH'd in.\n> \n> When Git signing fails over SSH an error looks like:\n> \n>    $ git commit -S log.h -m \"Remove unneeded header\"\n>    error: gpg failed to sign the data\n>    fatal: failed to write commit object\n> \n> I just noticed this today (but it makes sense)...\n> \n>     - Go to desktop workstation, log in\n>     - Go to remote machine, log in\n>     - Sign at remote machine over SSH\n>       - Desktop workstation will open GUI password prompt\n>       - Remote machine sign operation will hang until GUI prompt times-out\n\nThis isn't really a Git problem, so much as a GnuPG one.\nYou probably want to use the curses pinentry input instead of the GUI\none.  If you're using Ubuntu, you can set \"pinentry-program\n/usr/bin/pinentry-curses\" in ~/.gnupg/gpg-agent.conf, kill all of the\ngpg-agent processes, and then attempt to sign again.\n\nYou may also need to set GPG_TTY and/or kill the gpg-agent process when\nlogging in remotely.  See gpg-agent(1) for details on configuration and\nuse.\n-- \nbrian m. carlson: Houston, Texas, US\nOpenPGP: https://keybase.io/bk2204\n"},{"id":"392742","messageId":"CAH8yC8km9k3sWKpjuj=69Y8SC=VHcDkBk=8O9RuCDOGtWGyqQQ@mail.gmail.com","threadId":"52299","inReplyTo":"CAH8yC8n+ta4BSAE4rEfhKxe3T9poVdc94HvSk=6PEA4YbmwVyA@mail.gmail.com","subject":"Re: Commit signing and pinentry problems","fromName":"Jeffrey Walton","fromEmail":"noloader@gmail.com","sentAt":"2020-03-02T14:09:42Z","receivedAt":"2020-03-02T14:10:35Z","isPatch":false,"sender":{"key":"noloader@gmail.com","avatar":null},"body":"On Wed, Nov 20, 2019 at 7:41 AM Jeffrey Walton <noloader@gmail.com> wrote:\n>\n> I'm having an annoying problem that I can't figure out. I hope Git has\n> a setting to fix it.\n>\n> I have a desktop workstation where I sit at the keyboard about 1/3 of\n> the time. Git signing works as expected. About 2/3 of the time I SSH\n> into the machine. Git signing does not work when SSH'd in.\n>\n> When Git signing fails over SSH an error looks like:\n>\n>    $ git commit -S log.h -m \"Remove unneeded header\"\n>    error: gpg failed to sign the data\n>    fatal: failed to write commit object\n>\n> I just noticed this today (but it makes sense)...\n>\n>     - Go to desktop workstation, log in\n>     - Go to remote machine, log in\n>     - Sign at remote machine over SSH\n>       - Desktop workstation will open GUI password prompt\n>       - Remote machine sign operation will hang until GUI prompt times-out\n>\n> The problem was reported to Ubuntu but no activity:\n> https://bugs.launchpad.net/ubuntu/+source/pinentry/+bug/1852696 .\n>\n> Does anyone know how to use Git to work around pinentry brain-dead-ness?\n\nThis fellow's answer fixed this problem: https://stackoverflow.com/a/53641081\n\nJeff\n"}]}