赞
踩
在使用 git 拉取项目的时候,因为一直使用 git@xxxx 链接来 clone。后续在更新某一项目的 submodule 的时候,发现使用 http 方式不能拉取下来,但是 windows 可以,怀疑是代理问题,后续收集了一波资料后解决了,在此记录下。
以下错误信息都可能需要设置代理:
- fatal: unable to access ‘https://github.com/xxx/xxx.git/’: Empty reply from server
- gnutls_handshake() failed: The TLS connection was non-properly terminated
以下解决办法在电脑重启后需要重新设置一次,因为 wsl2 ip会发生变化,还有就是对 windows 端口协议保护重启后会被重新设置
在 wsl 的控制台输入
> echo "Host ip: $(cat /etc/resolv.conf | grep nameserver | awk '{ print $2 }')"
Host ip: 172.17.122.209
在管理员模式的 PowerShell 输入以下命令
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow
将 vEthernet(WSL)前面的勾去掉
git config --global http.https://github.com.proxy http://172.17.122.209:7890
git config --global https.https://github.com.proxy http://172.17.122.209:7890
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。