[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"$fRYUgWsisXq_1l9J9TYWeKmzWmrFAfh4UIUwXwroQ-F0":3},{"code":4,"message":5,"data":6},200,"成功",{"id":7,"createdAt":8,"title":9,"content":10,"summary":11,"image":12,"uid":13,"user":14,"categoryId":21,"category":22,"subCategoryId":24,"subCategory":25,"comments":27,"status":17,"reason":28,"notice":28,"visitCount":29,"commentCount":30,"keywords":31},16,"2024-01-19T15:18:03.329Z","git操作时的Operation timed out","问题描述：\n当在一个git仓库中手动操作git命令时，比如pull、push等时，或者在ssh -T git@github.com时，终端报错：ssh: connect to host github.com port 22: Operation timed out\n截图：\n![](https://image.xinwei.ltd/11705677326461.png)\n\n\n问题排查：\n1. 在Mac电脑中ssh文件夹的位置在：/Users/xxx/.ssh\n2. 查看其中的文件，截图如下：\n![](https://image.xinwei.ltd/21705677338850.png)\n\n3. 通过在github网站的ssh配置中，查看公钥都存在，而且known_hosts中也存在对应github的ssh公钥信息。\n4. known_hosts文件：known_hosts是系统生成的，在一些需要ssh操作中，通过ssh访问的主机的端口和公钥信息都会保存在这里。主要是保存你ssh访问某些主机时的身份信息到本地，防止中间人攻击。\n5. 然后就是因为: ssh -T git@github.com 测试访问时，提示端口22操作超时，如上面的问题截图所示。\n6. 那么这些文件配置没问题，那么最后确定就是端口22访问的问题，通过查找很多资料后发现，可以尝试将端口号22修改成443的https访问。\n\n解决办法：\n1.在ssh文件夹下需要一个config文件，在文件中配置github的host主机和端口，那么在进行ssh访问时，会从config文件中读取配置。\n```config\nHost github.com\n  Hostname ssh.github.com\n  Port 443\n```\n2.我们可以直接通过一行终端命令搞定。\n3.终端进入到ssh文件夹下:\n```terminal\ncd ~/.ssh\n```\n![](https://image.xinwei.ltd/31705677413273.png)\n\n4.那么在.ssh文件夹下没有config文件对吧，我们通过命令写入一下，然后会生成config文件（直接复制以下命令，回车就好）：\n```terminal\necho 'Host github.com\n  Hostname ssh.github.com\n  Port 443' >> config\n```\n![](https://image.xinwei.ltd/41705677448440.png)\n\n那么config文件自动就生成了，重新尝试链接github.com。\n5.看结果，成功被allowed了：\n![](https://image.xinwei.ltd/51705677461947.png)\n\n6.然后可以查看一下know_hosts文件，连接成功的端口是443了:\n![](https://image.xinwei.ltd/61705677474766.png)\n\n以上。\n","问题描述： 当在一个git仓库中手动操作git命令时，比如pull、push等时，或者在ssh -T git@github.com时，终端报错：ssh: connect to host github.com port 22: Operation timed out 截图： (https://image.xinwei.ltd/11705677326461.png) 问题排查： 1. 在Mac电脑中s","https://image.xinwei.ltd/11705677326461.png",499668042977349,{"phone":15,"userId":13,"nickName":16,"vipType":17,"avatar":18,"sign":19,"createdAt":20},"13121171998","全栈老韩",1,"https://image.xinwei.ltd/images/IMG_5430.JPG","全栈工程师，擅长iOS App开发、前端（vue、react、nuxt、小程序&Taro）开发、Flutter、React Native、后端（midwayjs、golang、express、koa）开发、docker容器、seo优化等。","2024-01-01T16:14:30.305Z",2,{"id":21,"name":23},"IT技术",31,{"id":24,"name":26,"parentId":21},"git&svn",[],"",81,0,"git,git error,operation timed out,git操作"]