0%

使用Git时连接失败

使用Git时连接失败

今天在使用git 提交时发现一直显示fatal: unable to access ‘https://github.com(后面是自己的)‘: Failed to connect to github.com port 443 after 21056 ms。

从网上搜集资料后发现应该是我的git没有走自己的vpn代理

因此设置如下:

配置socks5代理

1
2
git config --global http.proxy socks5 127.0.0.1:7890
git config --global https.proxy socks5 127.0.0.1:7890

配置http代理

1
2
git config --global http.proxy 127.0.0.1:7890
git config --global https.proxy 127.0.0.1:7890

查看代理

1
2
git config --global --get http.proxy
git config --global --get https.proxy

取消代理

1
2
git config --global --unset http.proxy
git config --global --unset https.proxy

其中的127.0.0.1 是你的主机号

7890是你的vpn代理端口号

image-20240417225742376