git 通过代理克隆GitHub仓库

人盡茶涼 提交于 2019-12-05 21:01:25

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://*.*.*.*:*'
  #使用git://协议
  git config core.gitProxy 'socks5://192.168.7.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

 

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!