go get 设置代理

使用go get xxxx无法下载项目,可以通过下面两步设置代理

第一步:设置控制台变量

  • windows cmd:
  1. 设置代理
set http_proxy=http://127.0.0.1:1081
set https_proxy=http://127.0.0.1:1081
  1. 取消代理:重新打开cmd
  • windows powershell:
  1. 设置代理
$ENV:http_proxy="http://127.0.0.1:1081"
$ENV:https_proxy="http://127.0.0.1:1081"
  1. 取消代理:重新打开powershell

第二步:设置git代理:

git config --global http.proxy http://127.0.0.1:1081
git config --global https.proxy http://127.0.0.1:1081

取消git代理:

git config --global --unset http.proxy
git config --global --unset https.proxy
注意:httphttps的代理都是指向的 http://127.0.0.1:1081 , 而不是 https:// xxxxx
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。