Github -- git clone 出现Failed to connect to 127.0.0.1 port XXX after XXX ms: Couldn't connect to server
问题描述
开启vpn后使用git clone 克隆github仓库失败,报错提示
Failed to connect to 127.0.0.1 port XXX after 7890 ms: Couldn't connect to server
解决方案
查看vpn软件端口号并修改git http与https代理端口号。
git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy https://127.0.0.1:7890
其他问题
更改git的代理端口设置后,连接其他git服务时可能出现报错:
(比如公司内网git服务器,关闭vpn后端口不通过,开启vpn身份验证不通过)
Failed to connect to 127.0.0.1 port 7890 after 7890 ms: Couldn't connect to server
或
fatal: Authentication failed for 'https://git-XXXX.XXXX.com/XXXXXX/XXXXX.git/'
解决方案
1.关闭clash代理并退出。
2.使用以下命令还原git端口设置。
git config --global --unset http.proxy
git config --global --unset http.proxy
ps:可使用
git config --global --list查看git代理设置。

浙公网安备 33010602011771号