github push:ssh: connect to host github.com port 22

原来的github的项目使用的是ssh来进行推送,今天再尝试推送发现push超时:

stackoverflow的帖子说:

How to fix "ssh: connect to host github.com port 22: Connection timed out" for git push/pull/... commands?

也就是找到.ssh文件夹然后在该文件夹下面添加一个config文件,文件内容为:

bash 复制代码
Host github.com
 Hostname ssh.github.com
 Port 443

重新run了一下:

bash 复制代码
ssh -T git@github.com

依旧超时:

bash 复制代码
ssh: connect to host github.com port 22: Connection timed out

尝试了另一个帖子:

输入

bash 复制代码
git config --local -e

修改了url为https协议。

重新push

fatal: unable to access 'https://github.com//xxx.git/': Failed to connect to github.com port 443 after 21100 ms: Timed out

443端口又超时了,参考了一篇知乎的文章最终解决了:

解决 Github port 443 : Timed out

修改网络配置:

bash 复制代码
git config --global http.proxy http://127.0.0.1:7890 
git config --global https.proxy http://127.0.0.1:7890

其他相关配置:

bash 复制代码
# 取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy

# 查看代理
git config --global --get http.proxy
git config --global --get https.proxy

推送github需要设置网络代理,如果推送gitee不需要了可以使用unset取消掉。

相关推荐
蹊黎5 小时前
Linux 进程概念(四):命令行参数与环境变量
linux·运维·服务器
AR-26710-8 小时前
docker Day3——镜像,容器,日志与元数据
运维·docker·容器
wflynn11 小时前
GitHub 今日推荐|univer:可嵌入 Web 应用的开源 Office 引擎
typescript·开源·github·doc·collaboration·board
dong_junshuai11 小时前
每天一个开源项目#163 Ghost Downloader:分块下载为何不用合并
github
网易云信11 小时前
AI 写 IM 集成总用错 API?用云信 AI Skills 把文档接进开发流程
github
猛码象限12 小时前
【GitHub 周报】换血八成,注意力从造 Agent 转向管 Agent
github·业界资讯
逛逛GitHub12 小时前
很多人想把《GTA 6》移植到 PC 上,这 4 个 GitHub 项目在努力。
github
逛逛GitHub13 小时前
谷歌 Chrome 团队出手了,GitHub 上获 1W 的 Star 了。
github
分布式存储与RustFS14 小时前
备份作业卡在许可证上:用 Veeam 13 把 Windows 整机备份落进 RustFS
运维·云原生·开源·对象存储·分布式存储·s3·性能基准
飞奔的瓜牛15 小时前
Linux 数据盘分区、格式化与自动挂载完整实践
linux·运维·服务器