github无法连接

Posted by shensunbo on August 4, 2024

wsl2 ubuntu

sudo vim /etc/resolv.conf 添加以下内容:

1
2
nameserver 8.8.8.8
nameserver 114.114.114.114

NOTE: 8.8.8.8 和 114.114.114.114 是常见的公共 DNS 服务器

可选: sudo vim /etc/wsl.conf 添加:

1
2
[network]
generateResolvConf = false

Note: 实测没什么作用,每次重新开机之后还是需要修改 /etc/resolv.conf

push 失败

修改为使用ssh协议:

1
2
3
4
fatal: unable to access 'https://github.com/shensunbo/shensunbo.github.io.git/': Failed to connect to github.com port 443 after 21050 ms: Timed out

// 修改为使用ssh协议
git remote set-url origin git@github.com:shensunbo/shensunbo.github.io.git