How do I add a repository from behind a proxy?

Solution 1:

Your issue is described on this following bug report, It seems that the proper fix is described at commment #11:

  1. Set the variable https_proxy to your proxy
  2. Edit /etc/sudoers or the correct file in /etc/sudoers.d/ so it contains:

    Defaults env_keep = https_proxy
    

Solution 2:

The script you've mentioned - launchpad-getkeys now has proxy support.

Solution 3:

Use the -HE option of sudo:

sudo -HE apt-key [...]

It will keep your proxy settings