{"action":"created","issue":{"url":"https://api.github.com/repos/smira/aptly/issues/385","repository_url":"https://api.github.com/repos/smira/aptly","labels_url":"https://api.github.com/repos/smira/aptly/issues/385/labels{/name}","comments_url":"https://api.github.com/repos/smira/aptly/issues/385/comments","events_url":"https://api.github.com/repos/smira/aptly/issues/385/events","html_url":"https://github.com/smira/aptly/issues/385","id":149436667,"number":385,"title":"GPG signing (key with passphrase) without a TTY fails even if passphrase is passed by flag","user":{"login":"ariaviran","id":16866170,"avatar_url":"https://avatars.githubusercontent.com/u/16866170?v=3","gravatar_id":"","url":"https://api.github.com/users/ariaviran","html_url":"https://github.com/ariaviran","followers_url":"https://api.github.com/users/ariaviran/followers","following_url":"https://api.github.com/users/ariaviran/following{/other_user}","gists_url":"https://api.github.com/users/ariaviran/gists{/gist_id}","starred_url":"https://api.github.com/users/ariaviran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ariaviran/subscriptions","organizations_url":"https://api.github.com/users/ariaviran/orgs","repos_url":"https://api.github.com/users/ariaviran/repos","events_url":"https://api.github.com/users/ariaviran/events{/privacy}","received_events_url":"https://api.github.com/users/ariaviran/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-04-19T11:54:22Z","updated_at":"2016-04-24T07:34:46Z","closed_at":null,"body":"Hi,\r\nI'm trying to execute a `publish` command automatically via SSH. My GPG key has a passphrase, so I pass it as a flag, but `aptly` fails due to a lack of tty, although no user input is needed.\r\n\r\nExample:\r\n```\r\n[14:23:29] [ari@malory] % ssh <host with aptly> \"sudo aptly publish switch -passphrase=<passphrase> <name> <snapshot>\"\r\nLoading packages...\r\nGenerating metadata files and linking package files...\r\nFinalizing metadata files...\r\nSigning file 'Release' with gpg, please enter your passphrase when prompted:\r\ngpg: cannot open tty `/dev/tty': No such device or address\r\nERROR: unable to publish: unable to detached sign file: exit status 2\r\n```\r\n\r\nWhen forcing SSH to create a tty it works **without user intervention**:\r\n```\r\n[14:34:58] [ari@malory] % ssh -tt <host with aptly> \"sudo aptly publish switch -passphrase=<passphrase> <name> <snapshot>\"\r\nLoading packages...\r\nGenerating metadata files and linking package files...\r\nFinalizing metadata files...\r\nSigning file 'Release' with gpg, please enter your passphrase when prompted:\r\n\r\nYou need a passphrase to unlock the secret key for\r\n<key details>\r\n\r\nClearsigning file 'Release' with gpg, please enter your passphrase when prompted:\r\n\r\nYou need a passphrase to unlock the secret key for\r\n<key details>\r\n\r\nCleaning up prefix \".\" components main...\r\n\r\nPublish for snapshot <name> [amd64] publishes <snapshot> has been successfully switched to new snapshot.\r\nConnection to <host with aptly> closed.\r\n```\r\n\r\nI believe this is a bug, a tty shouldn't be required if user intervention is not needed"},"comment":{"url":"https://api.github.com/repos/smira/aptly/issues/comments/213907867","html_url":"https://github.com/smira/aptly/issues/385#issuecomment-213907867","issue_url":"https://api.github.com/repos/smira/aptly/issues/385","id":213907867,"user":{"login":"ariaviran","id":16866170,"avatar_url":"https://avatars.githubusercontent.com/u/16866170?v=3","gravatar_id":"","url":"https://api.github.com/users/ariaviran","html_url":"https://github.com/ariaviran","followers_url":"https://api.github.com/users/ariaviran/followers","following_url":"https://api.github.com/users/ariaviran/following{/other_user}","gists_url":"https://api.github.com/users/ariaviran/gists{/gist_id}","starred_url":"https://api.github.com/users/ariaviran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ariaviran/subscriptions","organizations_url":"https://api.github.com/users/ariaviran/orgs","repos_url":"https://api.github.com/users/ariaviran/repos","events_url":"https://api.github.com/users/ariaviran/events{/privacy}","received_events_url":"https://api.github.com/users/ariaviran/received_events","type":"User","site_admin":false},"created_at":"2016-04-24T07:34:46Z","updated_at":"2016-04-24T07:34:46Z","body":"@michaelimfeld Thanks.\r\n@smira - I now see it is properly documented in the URL you provided, thank you. I think it will also be useful to add it to the question regarding GPG signing automation in the [FAQ](https://www.aptly.info/doc/faq/), or even better, since aptly knows that I don't need user interaction since I passed the 'passphrase' flag, it could pass automatically pass the 'batch' flag to GPG.\r\n\r\nThanks again"}}