How to use proxy for git command, sudo apt, in Ubuntu



Set proxy for svn
Configure in your ~/.subversion/servers
[global]
        http-proxy-host = 127.0.0.1
        http-proxy-port = 3128

Set proxy for git
git config --global http.proxy http://proxyUsername:proxyPassword@proxy.server.com:port


Or configure these globally in your user ~/.gitconfig file, e.g.,
[http]
         proxy = http://xxx.xxx.xxx.xxx:8000


Show current configuration
git config --global --get-regexp http.*
git config --global --list
git config --local --list


Unset proxy

git config --unset http.proxy




Set proxy for apt

sudo nano /etc/apt/apt.conf


add proxy settings, e.g.,

Acquire::http::proxy "http://proxy_username:password@proxy_ip:port";
Acquire::https::proxy "https://proxy_username:password@proxy_ip:port";
Acquire::ftp::proxy "ftp://proxy_username:password@proxy_ip:port";





Ubuntu set proxy

export http_proxy="http://PROXY_SERVER:PORT"
export https_proxy="https://PROXY_SERVER:PORT"
export ftp_proxy="http://PROXY_SERVER:PORT"


Unset
unset http_proxy
unset https_proxy
unset ftp_proxy


Install snap packages behind web proxy on Ubuntu
sudo snap set system proxy.http="http://<proxy_addr>:<proxy_port>"
sudo snap set system proxy.https="http://<proxy_addr>:<proxy_port>"

No comments:

Post a Comment