24

This question already has an answer here:

I am unable to add a repository via the command line on Ubuntu 14.04. Apt-get works perfectly fine, and I am able to update the system. I have configured my /etc/apt/apt.config file as follows:

Acquire::http::proxy "http://<username>:<password>@<proxy address>:<port>/";

For example, when trying to add the repository for y-ppa-manager, I receive:

add-apt-repository ppa:webupd8team/y-ppa-manager
Cannot add PPA: 'ppa:webupd8team/y-ppa-manager'.
Please check that the PPA name or format is correct.

If you need any more info., feel free to ask.

marked as duplicate by Oli Oct 1 '14 at 13:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

49

You need to export your proxy environment variables using

export http_proxy=http://username:password@host:port/
export https_proxy=https://username:password@host:port/

and then tell sudo to use them using:

 sudo -E add-apt-repository ppa:webupd8team/y-ppa-manager

or open your /etc/sudoers file (using sudo visudo) and append

Defaults env_keep="https_proxy"

to the end of the file.

I have a blog on this, have a look at it for more details.

  • 1
    Thank you so much Jobin for the prompt reply! I used Method 1 from your blog, so I don't have to remember the "-E" each time. – bjd857 Apr 22 '14 at 6:34
  • In my case the problem was solved by this method: askubuntu.com/questions/355729/cant-add-any-ppas I mention this because it was not so easy to find in google (in my case the results point to this kind of solutions). – Damian Nadales Jul 11 '14 at 6:39
  • 2
    alias sudo=sudo -E – DmitrySandalov Nov 26 '14 at 15:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.