打开本地文件:C:\Windows\System32\drivers\etc\hosts,以管理员方式修改hosts文件,直接在末尾添加如下内容:
140.82.112.25 alive.github.com
140.82.114.6 api.github.com
185.199.110.153 assets-cdn.github.com
140.82.113.22 central.github.com
185.199.108.133 cloud.githubusercontent.com
140.82.113.9 codeload.github.com
140.82.112.22 collector.github.com
140.82.112.4 gist.github.com
52.216.146.155 github-cloud.s3.amazonaws.com
52.217.204.137 github-com.s3.amazonaws.com
54.231.163.81 github-production-release-asset-2e65be.s3.amazonaws.com
52.217.44.156 github-production-repository-file-5c1aeb.s3.amazonaws.com
52.216.54.145 github-production-user-asset-6210df.s3.amazonaws.com
192.0.66.2 github.blog
140.82.112.4 github.com
140.82.114.17 github.community
185.199.109.154 github.githubassets.com
151.101.65.194 github.global.ssl.fastly.net
185.199.110.153 github.io
185.199.110.153 githubstatus.com
140.82.112.25 live.github.com
13.107.43.16 pipelines.actions.githubusercontent.com
13.107.238.40 vscode.dev
然后重启pycharm,尝试开启代理后即可登录github。
建议最好在设置的HTTP代理中测试一下github.com是否可以连接,如下图所示:
解决方案取自:https://github.com/orgs/community/discussions/64334
这个大佬,非常感谢!!!