Search code examples
githubgnupg

GPG: Generating key fails with cannot get input error


I was trying to generate new GPG key on my Ubuntu 16.10 for GitHub. However, it ended with an error message gpg: Sorry, no terminal at all requested - can't get input. I tried gpg2 as well with no difference.

Including terminal output:

greeny@greenyNB:~$ gpg2 --gen-key
gpg (GnuPG) 2.1.11; Copyright (C) 2016 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

gpg: Sorry, no terminal at all requested - can't get input


greeny@greenyNB:~$ gpg --gen-key
gpg (GnuPG) 1.4.20; Copyright (C) 2015 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

gpg: Sorry, no terminal at all requested - can't get input

How can I fix this to be able to generate GPG key?


Solution

  • Thanks to Jens Erat for his comment, solution: remove no-tty line from gpg.conf.