方法一:同事大力推薦,暫時(shí)還沒試過,先記下來
https://github.com/goproxy/goproxy.cn/blob/master/README.zh-CN.md
方法二:從github鏡像上clone下來
- 進(jìn)到$GOPATH/src/golang.org/x路徑下,打開cmd:
git clone --depth 1 https://github.com/golang/tools.git #為了防止失敗,只取最近1次commit
git config --global http.sslVerify "false" #如果clone報(bào)錯(cuò):OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054
方法三:設(shè)置全局代理,略復(fù)雜,而且用完要手動(dòng)取消設(shè)置
- 設(shè)置代理端口
set http_proxy=127.0.0.1:1080
set https_proxy=127.0.0.1:1080
- 設(shè)置git代理
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
- 取消代理端口
set http_proxy=
set https_proxy=
- 取消git代理
git config --global --unset http.proxy
git config --global --unset https.proxy