> 技术文档 > WSL2 在vscode无法连接copilot_wsl copilot

WSL2 在vscode无法连接copilot_wsl copilot

报错情况

本机可以使用copilot,但在WSL2上无法连接,报错信息如下:

检查网络情况:

ping api.github.com

发现无法连接:

github.com:Temporary failure in name resolution

在网上搜集的解决方法:在设置中增加代理,但并不work

【Copilot】GitHub Copilot could not connect to server. Extension activation failed: “read ECONNRESET“-CSDN博客

故我关闭VPN,避免情况复杂,解决方法如下:

1.检查DNS

sudo vim /etc/resolv.conf

# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:# [network]# generateResolvConf = falsenameserver 8.8.8.8nameserver 8.8.4.4

2. 重启网络,更新apt

sudo service network-manager restart

若未安装,先:sudo apt install network-manager

更新apt:

sudo apt-get update

sudo apt-get upgrade

3.再次ping

若未成功,可以重启尝试。