(一)設置代理
(1)命令方式設置http代理:git config --global http.proxy xxxx
(2)命令方式設置https代理:git config --global https.proxy xxxx
(3)命令方式設置core代理:git config --global core.gitproxy xxxx
(4)配置文件方式設置代理:找到.gitconfig文件,添加如下內容:
[http]
proxy = xxx
[https]
proxy = xxx
[core]
gitproxy = xxx
(二)取消代理
(1)命令方式:git config --global --unset http.proxy
git config --global --unset https.proxy
git config --global --unset core.gitproxy
(2)文件方式:找到.gitconfig文件,直接將http段下的proxy區塊刪除,https段下的proxy區塊刪除,core段下的gitproxy區塊刪除,刪除后效果如下所示:
[http]
[https]
[core]