git設定下載代理

zmxyzmxy1234發表於2020-08-21

因為某些原因,我們下載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,看你軟體自己的設定,這裡我用的是V2XXX

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
本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章