【报错解决】使用代理后从Github中clone仓库报错

发布时间 2023-07-14 12:13:19作者: 因为风的缘故~

当电脑使用代理后,会造成Github的clonepush等功能无法正常使用

报错内容:

PS D:\Github> git clone https://github.com/sige5193/bittly.git
Cloning into 'bittly'...
fatal: unable to access 'https://github.com/sige5193/bittly.git/': Failed to connect to github.com port 443 after 21095 ms: Couldn't connect to server

解决办法

检查本机代理

以win11为例,设置->网络和Internet->代理->手动设置代理一栏->编辑 , 记下系统所使用代理的端口号

img

修改Git代理配置

7890修改为上面获取到的系统所使用代理的端口号

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

重新clone仓库即可

PS D:\Github> git clone https://github.com/sige5193/bittly.git
Cloning into 'bittly'...
remote: Enumerating objects: 6424, done.
remote: Counting objects: 100% (2047/2047), done.
remote: Compressing objects: 100% (711/711), done.
remote: Total 6424 (delta 1400), reused 1957 (delta 1316), pack-reused 4377Receiving objects: 100% (6424/6424), 46.18 MiReceiving objects: 100% (6424/6424), 49.60 MiB | 2.02 MiB/s, done.

Resolving deltas: 100% (3633/3633), done.