If you’re running Ubuntu behind a corporate proxy, chances are you’ve set up your http_proxy environment variables so that things like
npm work. However, you might just come a-cropper when you’re trying to add a PPA like I did when I wanted to install neovim.
Following the neovim wiki you need to add the PPA with the following command:
sudo add-apt-repository ppa:neovim-ppa/unstable
However Ubuntu doesn’t play ball and reports back:
Cannot add PPA: 'ppa:neovim-ppa/unstable'. Please check that the PPA name or format is correct.
You can, of course, manually add it to your system’s
sources.list. But that’s cheating :).
The problem here is your
http_proxy environment variables have not propogated through when you run
sudo. The solution is to run your
add-apt-repository as follows:
sudo -E add-apt-repository ppa:neovim-ppa/unstable
-E preserves the environment, which means your
http_proxy is now available and your PPA will be added.