git设置下载代理

因为某些原因,我们下载git clone GitHub特别慢

git clone https://github.com/zoujingli/ThinkAdmin.git
Cloning into 'ThinkAdmin'...
remote: Enumerating objects: 663, done.
remote: Counting objects: 100% (663/663), done.
remote: Compressing objects: 100% (483/483), done.
Receiving objects:   1% (389/32521), 68.01 KiB | 6.00 KiB/s

这时候就需要一个代理,不然下载要等到明年,首先你要有一台代理服务器(看看网上有没有好心人共享),然后一般windows代理的端口是1080,看你软件自己的设置,这里我用的是V2Ray

inbounds": [
    {
      "tag": "proxy",
      "port": 1080,
      "listen": "127.0.0.1",
      "protocol": "socks",
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      },

然后命令行输入,注意git没有https代理,http包含了https,网上的教程都有误,而且地址不能加单引号

git config --global http.proxy socks5://127.0.0.1:1080

查看所有代理

git config --global --list

取消代理

git config --global --unset http.proxy

查看成果,这速度杠杠的

Cloning into 'ThinkAdmin'...
remote: Enumerating objects: 663, done.
remote: Counting objects: 100% (663/663), done.
remote: Compressing objects: 100% (483/483), done.
Receiving objects:  14% (4553/32521), 4.90 MiB | 990.00 KiB/s

你可能感兴趣的:(git,github)