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
相关推荐
黎羽_4 小时前
《开源 PR 实战》系列(三):22 个 PR 之后,批量提 PR 的打法
开源·github·代码评审·pull request·协作
fthux8 小时前
总想着“忙完再休息”?让 Tick Rest 提醒你,先歇一会儿
开源·github·mac·swift·提醒·消息提醒·tick rest·tick rest for mac·消息提醒app
dong_junshuai9 小时前
每天一个开源项目#156 Astryx:主题编译、异步按钮与源码接管
github
逛逛GitHub11 小时前
把你的 AirPods 当鼠标用,这 3 个黑科技 GitHub 开源项目有趣。
github
kuroomi13 小时前
Git入门
git·kubernetes
daliucheng13 小时前
lazygit 上手:日常 git 操作一篇讲完
git
徐小夕14 小时前
开源Vector-Graph-RAG:向量+图谱双引擎,打破纯向量RAG的效果天花板
前端·vue.js·github
GitHub实测笔记14 小时前
zoxide 本机实测:一万条记查询中 5.7ms0.10 版 import --from
github
codigger15 小时前
大厂git提交规范
git·程序员
挖掘狂人15 小时前
六条分支,一条主干:我的 Git 分支管理心得
git·后端·程序员