git push ssh: connect to host stgit.dcs.gla.ac.uk port 22: Operation timed out

问题描述

在Gitlab上创建了仓库并且完成了第一次push,但之后push出现了一下问题:
ssh: connect to host stgit.dcs.gla.ac.uk port 22: Operation timed out

查了资料之后,确定在个人设置处设置了ssr key,也试过新建ssr key和修改全局设置但都没用,最后在stackoverflow上找到了解决方法。

首先自测一下链接git@[此处是你的主页]

ssh -T [email protected]

如果timeout了,那应该就是因为当前网络防火墙的问题,则可按照一下步骤解决

解决方案

打开git的config

git config --local -e

修改url = 后的内容
例如将

url = [email protected]:username/repo.git

改为

url = https://github.com/username/repo.git

此处的url在git项目主页获得
在这里插入图片描述
至此问题应该就解决了
参考资料:
stackoverflow

猜你喜欢

转载自blog.csdn.net/qq_33445510/article/details/104667222
今日推荐