最近学GO要git clone某些包,老麻烦了,挂了全局clash都clone不了,只好百度一下,顺便做一下笔记。
CMD 设置代理
开启cmd
无账号密码
set http_proxy=http://proxy.yourname.com:8080
有账号密码则需要继续执行
set http_proxy_user=
set http_proxy_pass=
Git 设置代理
Git 的代理设置也非常简单,一句话就搞定了:
git config --global http.proxy http://10.10.10.10:8080
如果需要用户名密码的话,则设置:
git config –-global http.proxy http://user:password@http://10.10.10.10:8080
其中 user 和 password 分别为你的用户名和密码。
设置完成后,可以通过如下命令来查看设置是否生效:
git config –-get –-global http.proxy
返回目前设置的代理地址
删除代理设置,那么可以使用:
git config --system (或 --global 或 --local) --unset http.proxy