一、方案一
?下面的命令只針對github.com
,在國內(nèi)還可能會用到gitee.com
,所以不能將所有的 git 站點都添加上代理。
# 設(shè)置代理
git config --global http.https://github.com.proxy socks5://127.0.0.1:1086
# 取消代理
git config --global --unset http.https://github.com.proxy
?使用cdn加速
git config --global url."https://ghproxy.com/https://github.com".insteadOf "https://github.com"
或者文章來源:http://www.zghlxwxcb.cn/news/detail-718998.html
git config --global url."https://hub.fastgit.xyz/".insteadOf "https://github.com/"
二、方法二
2.1?打開hosts文件
sudo vim /etc/hosts
?2.2 在添加github.com域名(localhost下添加即可)
140.82.114.4 github.com
?如果不行或者網(wǎng)速過慢可以嘗試換個域名,在網(wǎng)上能搜到文章來源地址http://www.zghlxwxcb.cn/news/detail-718998.html
三、方法三
#取消http代理
git config --global --unset http.proxy
#取消https代理
git config --global --unset https.proxy
到了這里,關(guān)于Failed toconnect to github.com port 443: 拒絕連接 Could not resolve host: github.com的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!