最近更新项目,发现push的时候出现:
Ssh: connect to host github.com port 22: Connection timed out
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
然后输入ssh -T git@github.com出现:
ssh: connect to host github.com port 22: Connection timed out
解决方案:
- 重新生成ssh:
ssh-keygen -t rsa -C “你的邮箱”
- 默认生成的key在:C:\Users\yourUserName.ssh中有3个文件:
- github上配置key
- $ ssh -T git@github.com验证连接:报错
Ssh: connect to host github.com port 22: Connection timed out
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
- 在ssh文件夹下添加config文件,内容如下:
Host github.com
User git
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443
- $ ssh -T git@github.com