Git报错fatal unable to connect to github.com: github.com[0: 20.205.243.166]: errno=unknown error的解决方法

今天创建了新的GitHub项目,进行git clone时报错

fatal: unable to connect to github.com: github.com[0: 20.205.243.166]: errno=unknown error

经查,这个问题是由于Git 协议通常使用端口 9418,但是有些网络环境可能会限制对此端口的访问,或者直接阻止使用 Git 协议。因此,我们需要将git://github.com/替换为https://github.com/,这样可以确保与 GitHub 进行通信。

我们可以执行下面的命令:

复制代码
git config --global url.https://github.com/.insteadOf git://github.com/

再执行git clone就顺利通过啦~

(这条指令用于改变 Git 与 GitHub 之间的传输协议。用于提高兼容性,确保在各种网络环境中都可以访问 GitHub 存储库。如果您不受网络限制,通常没有必要执行这种替换操作,因为 Git 默认会使用 HTTPS 协议来访问 GitHub 存储库。)

相关推荐
一个程序猿老马7 小时前
012、远程协作:连接GitHub/Gitee与git remote
git·gitee·github
小柯博客10 小时前
STM32MP2安全启动技术深度解析
c语言·c++·stm32·嵌入式硬件·安全·开源·github
zhensherlock10 小时前
Protocol Launcher 系列:Tally 快速计数器的深度集成
前端·javascript·typescript·node.js·自动化·github·js
Lisonseekpan11 小时前
Git:如何将一个分支的特定提交合并到另一个分支?
java·大数据·git·后端·elasticsearch
pas13613 小时前
git 配置
git
独隅16 小时前
Git误操作急救手册
大数据·git·elasticsearch
水无痕simon16 小时前
03 Git 工作流程
git
一个程序猿老马17 小时前
013、推送与拉取:git push与git pull的协作流程
大数据·git·elasticsearch
darkb1rd18 小时前
OpenMythos:从零重构大模型架构实战指南
开源·github·好物分享
弑神风19 小时前
GitHub Copilot vs Cursor深度横评(2026):谁是AI编程之王?
程序员·github·copilot·ai编程·cursor·工具测评