git 通过代理克隆GitHub仓库

windows环境使用局部配置

Git常用的有两种协议

 

不同的协议他的代理配置各不相同。core.gitproxy 用于 git:// 协议,http.proxy 用于 http:// 协议。
常见的git clone 协议如下:
不走代理:
  #使用http://协议   
  git clone https://github.com/EasyChris/baidu.git   
  #使用git://协议
  git clone git@github.com:EasyChris/baidu.git
走代理方式:
  #使用http://协议
  git clone -c http.proxy="http://127.0.0.1:1080" https://github.com/madrobby/zepto.git
  #通常小飞机的代理在本机地址是127.0.0.1 代理端口是1080
  git config http.proxy 'socks5://127.0.0.1:1080'
  #使用git://协议
  git config core.gitProxy 'socks5://127.0.0.1:1080'

 

windows环境下增加全局配置

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 -l

 

 

 
posted on 2019-11-28 01:02  小朱配齐  阅读(2277)  评论(0编辑  收藏  举报