Github 更新代码报错解决方式
服务器改用ssh方式更新代码,报错ssh: connect to host github.com port 22: Connection timed out
在服务器生成了新的 SSH 密钥,并配置到了github之后,git pull 的时候还是报错:`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`
解决方案:
1.进入.ssh目录 `cd ~/.ssh`
2.新建一个以config为文件名的文件
3.写入以下内容:
`
Host github.com
User github的邮箱
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_ed25519
Port 443
`
4.将文件权限给600
5.执行`ssh -T git@github.com`测试连接
至于如何添加SSH Key,可以查看这里