ssh: connect to host github.com port 443: Connection timed out 解决方法

前言

我是本地配置了,是全局代理。

解决步骤:

1.配置git代理

如下图:参数是主机ip + 端口号。那么如何得来的呢?是这里:
ssh: connect to host github.com port 443: Connection timed out 解决方法_第1张图片

git config --global http.proxy 127.0.0.1:10809

git config --global https.proxy 127.0.0.1:10809

这一步,配置好后,就可以用GitHub的https来推送和提交代码了。如下:

git clone https://github.com/xxxx.git

但是如果想用ssh呢?如果直接在此步骤执行完,执行。会报如下错(端口号22不行):
在这里插入图片描述
那么继续往下面配置

2.配置~/.ssh/config

# github
Host github.com
HostName ssh.github.com
Port 443
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa

执行测试命令:发现成功了!这时候,就可以用ssh了。
在这里插入图片描述

你可能感兴趣的:(git,ssh,github,运维)