Wget, Apt and Git behind proxy

For Wget

Add/Comment out below line(s) in file ~/.wgetrc or /etc/wgetrc:

http_proxy = http://[Proxy_Server]:[port]
https_proxy = http://[Proxy_Server]:[port]
ftp_proxy = http://[Proxy_Server]:[port]

For Apt

Create a new configuration file named proxy.conf.sudo touch /etc/apt/apt.conf.d/proxy.conf
Open the proxy.conf file in a text editor.sudo vi /etc/apt/apt.conf.d/proxy.conf

Paste it as following:

Acquire {
HTTP::proxy "http://127.0.0.1:8080";
HTTPS::proxy "http://127.0.0.1:8080";
}

For Git:

git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080

change proxyuser to your proxy user
change proxypwd to your proxy password
change proxy.server.com to the URL of your proxy server
change 8080 to the proxy port configured on your proxy server
Note that this works for both http and https repos.

If you decide at any time to reset this proxy and work without proxy:

Command to use:

git config --global --unset http.proxy

Finally, to check the currently set proxy:

git config --global --get http.proxy
Share

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.