apt使用socks5代理
ubuntu 20.04
在/etc/apt/apt.conf.d下新建proxy.conf,输入
Acquire::http::Proxy "socks5h://172.17.0.1:1080";
Acquire::https::Proxy "socks5h://172.17.0.1:1080";
Acquire::socks::Proxy "socks5h://172.17.0.1:1080";
As the man page says, socks5h, not socks5, is supported by apt, which means socks5 proxy with DNS resolving ability
参考:
Configure proxy for APT? - Ask Ubuntu
git使用socks5代理
使用代理
git config --global http.proxy 'socks5://127.0.0.1:7070'
取消使用代理
git config --global --unset http.proxy
虽然名为 http.proxy ,但是使用https时也会使用这个代理。
AND
If you also want the host name to be resolved using the proxy, use socks5h instead of
socks5
参考:
ssh - Using a socks proxy with git for the http transport - Stack Overflow