报错情况:
本机可以使用copilot,但在WSL2上无法连接,报错信息如下:
检查网络情况:
bash
ping api.github.com
发现无法连接:
github.com:Temporary failure in name resolution
在网上搜集的解决方法:在设置中增加代理,但并不work
故我关闭VPN,避免情况复杂,解决方法如下:
1.检查DNS
sudo vim /etc/resolv.conf
bash
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 8.8.8.8
nameserver 8.8.4.4
- 重启网络,更新apt
sudo service network-manager restart
若未安装,先:sudo apt install network-manager
更新apt:
sudo apt-get update
sudo apt-get upgrade
3.再次ping
若未成功,可以重启尝试。