Problem:
In Ubuntu 16.04,
when try to update or download application in Terminal,
the system periodically failed to access the internet,
came back with error '407 Proxy Authentication Required'.
Solution:
全局:
For your apt-get to work, you should edit your apt config file:
sudo
-H gedit /etc/apt/apt.conf
And add Acquire::http::Proxy"http://username:password@proxyhost:port/";
The syntax shown above should be strictly followed.
This configuration may fail if your username or password has an '@' in it.You can also add proxy configuration for other protocols such as FTP.
Update:If your username or password has '@' in it you can replace it with%40 Example:If your password is @123
enter it as %40123
.
for Git:
first
git config --global http.proxy http://username:password@proxiURL:proxiPort
then
git config --global http.sslVerify false
(I confirm it's necessary : if set to true getting "SSL certificate problem: unable to get local issuer certificate" error)
in my case, no need of defining all_proxy nor https_proxy variables
and finally
git clone https://github.com/someUser/someRepo.git
×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
一下基本没用,作为备份参考
Below is the solution quoted form Stack
Adding to /etc/apt/apt.conf
, /etc/apt/apt.conf.d/01proxy
, /etc/apt/apt.conf.d/01ubuntu
:
Acquire::http::proxy "http://name:password@proxy_server:port";
export http_proxy=http://name:password@proxy_server:port/
on a terminal.
Adding export http_proxy=http://name:password@proxy_server:port/
to /etc/bash.bashrc