fatal: unable to access ‘https://github.com/.../.git‘: Could not resolve host: github.com解决方法【亲测有效】

简介: 1.问题原因今天在使用Github的时候突然出现了这样的报错,云里雾里,看了网上的解决办法,说是代理服务器的问题,尝试了无数遍无果然后Ping了一下github网站,发现Ping不通:


1.问题原因


今天在使用Github的时候突然出现了这样的报错,云里雾里,看了网上的解决办法,说是代理服务器的问题,尝试了无数遍无果

然后Ping了一下github网站,发现Ping不通:


ping github.com


这里考虑应该是hosts文件解析的问题🤷‍♂️


2.解决办法


在hosts文件中加入如下三行:


140.82.112.3 github.com
199.232.5.194 github.global.ssl.fastly.net
54.231.114.219 github-cloud.s3.amazonaws.com


140.82.112.3 是github网站服务器的真实IP地址,如果你想获得最新的,可以从这里获取:Github IP address

再次Ping github.com,可以Ping通啦!✌


> ping github.com
正在 Ping github.com [140.82.112.3] 具有 32 字节的数据:
来自 140.82.112.3 的回复: 字节=32 时间=308ms TTL=42
来自 140.82.112.3 的回复: 字节=32 时间=292ms TTL=42
来自 140.82.112.3 的回复: 字节=32 时间=298ms TTL=42
来自 140.82.112.3 的回复: 字节=32 时间=300ms TTL=42
140.82.112.3 的 Ping 统计信息:
    数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
    最短 = 292ms,最长 = 308ms,平均 = 299ms


此时再次进行pullpush操作,发现成功了!问题解决🚀

目录
相关文章
|
4月前
|
开发工具 git C++
【App Service】VS Code直接部署App Service时候遇见 “fatal: not a git repository (or any of the parent directories): .git”
通过VS Code发布Python App Service的时候,遇见了发布失败错误: The deployment failed with error: fatal: not a git repository (or any of the parent directories): .git . Please take a few minutes to help us improve the deployment experience
110 24
|
3月前
|
网络安全 开发工具 git
解决fatal:remote error:You can’t push to git://github.com/username/*.g
通过上述诊断与修复步骤,绝大多数的推送错误都能得到有效解决,确保您的Git工作流顺畅无阻。
294 1
|
6月前
|
网络协议 Shell 网络安全
ssh: connect to host github.com port 22: Connection refused
本文讨论了在使用Git命令操作GitHub时遇到的"ssh: connect to host github.com port 22: Connection refused"错误,分析了可能的原因,并提供了使用443端口或https协议作为解决方案,最终确定问题是由于DNS解析错误导致,通过修改hosts文件解决。
ssh: connect to host github.com port 22: Connection refused
|
5月前
|
Shell 网络安全 开发工具
fatal: unable to access 'https://github.com/wolfcw/libfaketime.git/': Encountered end of file
fatal: unable to access 'https://github.com/wolfcw/libfaketime.git/': Encountered end of file
|
6月前
|
开发工具 git
成功解决:fatal: detected dubious ownership in repository at ‘E:/workspace/CSMarket‘。如何使用git工具通过命令行的形式
这篇文章分享了作者在使用Git工具初始化本地仓库时遇到的权限问题,提供了通过命令行解决Git仓库权限问题的方案,并介绍了如何使用Git命令行初始化项目、添加文件、提交以及关联远程仓库的步骤。
成功解决:fatal: detected dubious ownership in repository at ‘E:/workspace/CSMarket‘。如何使用git工具通过命令行的形式
|
6月前
|
网络安全 开发工具 数据安全/隐私保护
Win10使用Git克隆项目出现fatal: Authentication failed for异常
Windows 10系统中使用Git克隆项目时出现"fatal: Authentication failed for"异常的解决方法,主要是通过修改凭据管理器中的Git凭据密码来解决因密码过期导致的身份验证失败问题。
149 0
Win10使用Git克隆项目出现fatal: Authentication failed for异常
|
开发工具 git 开发者
Git与Github两者的区别|学习笔记
快速学习Git与Github两者的区别
108 0
|
开发工具 git CDN
Git与GitHub学习笔记(五)一次提交失败的记录
代码已经跟踪了,添加注释说明,但是总是添加不了 error: pathspec 'live-page'' did not match any file(s) known to git. 重复了好多遍,最后发现代码还是没有提交 D:\wamp64\www\study-line>git commi...
1711 0
|
开发工具 git
Git与GitHub学习笔记(四)合并远程分支
在这里的前提: 1、你已经fork 源作者的项目到你自己的仓库了 2、git clone 自己仓库fork的项目,注意地址,这里是自己的账号下的地址,而不是源作者的项目地址哦 3、在本地修改代码,git push origin master 提交到自己的主分支(自定义别的分支),  提交一个新的...
1066 0
|
开发工具 git
Git与GitHub学习笔记(二)提交的一些笔记
1、合并分支的使用一定要切换到master分支上去合并:git merge company2、切换分支的时候一定要提交干净本地分支的代码,才可以切换分支,否则提示错误信息: 3、这时候我们做的就是提交干净本地的代码,再次切换即可以 4、下来我们要合并一个远程的分支home分支到master主分支...
1173 0