gpg: can't open `–': No such file or directory

I’d like to install php 56 on my Debian Wheeyz System. So I added the dotdeb repo to apt.
While fetching the key, an error occurred:

   # wget -O- |apt-key add –
   # gpg: can't open `–': No such file or directory

What do I have to change to add the key to apt?

Asked By: KFO


Use this:

wget -qO - | apt-key add -

You need a space after the -O and the character after add seems to be wrong. -q turns off the output of wget.

Answered By: A.B.

Your only problem is that the dash after apt-key add is not the ASCII 0x2D hyphen character, but the Unicode U+2013 en dash. The former instructs apt-key to read the key from the standard input (where the preceding wget provides it through the pipe), while the latter is not treated specially, thus interpreted as a file name to read the key from. Unsurprisingly, such a file does not seem to exist in your current directory.

Answered By: Ferenc Wágner
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.