linux下設置git代理訪問.


有時候克隆倉庫巨慢無比,需要設置代理.
一般情況下 proxychains 可以搞定的.
但是某些情況,如go 安裝模塊的時候是調用git的.這個時候proxchains就不行了.

go 也可以通過設置 GOPROXY 這個環境變量來設置代理的.
export GOPROXY=https://goproxy.io
其實 git 可以單獨設置代理的.

設置http代理
git config --global https.proxy http://127.0.0.1:1080
設置https代理
git config --global https.proxy https://127.0.0.1:1080
取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy
設置socks5代理
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
取消代理
git config --global --unset  http.proxy
git config --global --unset  https.proxy
只對github.com
git config --global http.https://github.com.proxy socks5://127.0.0.1:1080
#取消代理
git config --global --unset http.https://github.com.proxy

一般只要設置 http.proxy就可以了. https.proxy不用設置.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM