第一種辦法:設(shè)置全局代理
設(shè)置全局代理:
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy http://127.0.0.1:1080
再次嘗試,一般情況下可以正常clone。
如果遇到以下報錯:
Failed to connect to 127.0.0.1 port 1080 after 2070 ms: Connection refused
請采取第二種方法。
第二種方法:修改hosts文件(以windows系統(tǒng)為例)
1.打開https://github.com.ipaddress.com/ 如下圖:
?記錄IP地址(可能與上圖有差異)!
2.打開https://fastly.net.ipaddress.com/github.global.ssl.fastly.net#ipinfo 如下圖:
?
記錄4個IPV4地址!
3.修改hosts文件
windows的hosts文件在C:\Windows\System32\drivers\etc\文件夾下,
在hosts文件夾中添加剛才復(fù)制的ip,格式如下:
如果遇到訪問權(quán)限的問題,遵守以下方法操作即可修改權(quán)限:?
修改完權(quán)限后,需要刷新dns,cmd命令如下(需要進(jìn)入管理員模式!):
#刷新DNS緩存
ipconfig /flushdns
#展示DNS緩存
ipconfig /displaydns
大功告成!,愉快的進(jìn)行g(shù)it clone吧!
文章來源:http://www.zghlxwxcb.cn/news/detail-572016.html
?文章來源地址http://www.zghlxwxcb.cn/news/detail-572016.html
到了這里,關(guān)于git clone 時Failed to connect to github.com port 443:connection timed out 怎么辦的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!