GitHub推送 代码时报错:
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
and the repository exists.
解决方案:
- 进入
C:\Users\{你的用户名}\.ssh
目录 - 新建
config
文件,不要有后缀名 - 增加以下内容
Host github.com
User {
你的邮箱}
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443
例如:
Host github.com
User 55856773@qq.com
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443
即可解决!