Github 正常访问但是ping不同也无法进行git操作

Github 正常访问但是ping不同也无法进行git操作

原因:在git push 的时候 发现一直push不上去。

shell 复制代码
$ git push interview master
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

网站可以正常访问,但是主机ping却ping不通

shell 复制代码
C:\Users\26611>ping github.com

正在 Ping github.com [20.205.243.166] 具有 32 字节的数据:
请求超时。
请求超时。
请求超时。
请求超时。

20.205.243.166 的 Ping 统计信息:
    数据包: 已发送 = 4,已接收 = 0,丢失 = 4 (100% 丢失),

经过查询资料可以修改将github ip 添加到hosts 文件中

github动态ipwww.github.com - GitHub · Build and ship software on a single, collaborative platform · GitHub

win10 hosts 文件位置 如下图

可以ping通

shell 复制代码
C:\Users\26611>ping github.com

正在 Ping github.com [140.82.112.4] 具有 32 字节的数据:
来自 140.82.112.4 的回复: 字节=32 时间=291ms TTL=45
来自 140.82.112.4 的回复: 字节=32 时间=430ms TTL=45
来自 140.82.112.4 的回复: 字节=32 时间=299ms TTL=45
来自 140.82.112.4 的回复: 字节=32 时间=318ms TTL=45

140.82.112.4 的 Ping 统计信息:
    数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
    最短 = 291ms,最长 = 430ms,平均 = 334ms

git操作可以正常操作了

shell 复制代码
$ git push interview master
Enumerating objects: 25, done.
Counting objects: 100% (25/25), done.
Delta compression using up to 12 threads
Compressing objects: 100% (22/22), done.
Writing objects: 100% (22/22), 386.20 KiB | 1.69 MiB/s, done.
Total 22 (delta 10), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (10/10), completed with 3 local objects.
To github.com:hnsqls/interview.git
   afbfadb..a5d5746  master -> master
相关推荐
CAE虚拟与现实17 分钟前
GitHub Desktop 和 Git 命令行工具(CLI)各有优势
git·github·github desktop
RePeaT37 分钟前
代码双仓库备份指南:三种简单高效的方法
git·github
uhakadotcom1 小时前
HMAC signature通常是用来干什么的
后端·面试·github
coderklaus2 小时前
Git GC
git
就是帅我不改3 小时前
颠覆认知!阿里P8揭秘:用这种架构竟能扛住春晚亿级流量?
后端·面试·github
洗荡千万春3 小时前
如果让项目使用自定义的maven版本去构建——maven wrapper
java·架构·github
掘金安东尼4 小时前
互联网不再由 URL 为核心入口
前端·人工智能·github
xiezhr4 小时前
Git提交错了,别慌!还有后悔药
git·gitlab·github
GGGGGGGGGGGGGG.7 小时前
CI/CD 全链路实践:从 Git 基础到 Jenkins + GitLab 企业级部署
运维·git·ci/cd·云原生·gitlab·jenkins