赞
踩
昨天在使用VsCode向GitHub上传代码时,出现错误:(此前已经使用SSH的方式连接了GitHub仓库)
ssh: connect to host github.com port 22: Connection timed out
Please make sure you have the correct access rights
and the repository exists.
- ssh: connect to host github.com port 22: Connection timed out
- Please make sure you have the correct access rights
- and the repository exists.
首先输入以下命令检查SSH是否能够连接成功(ssh后面有空格)
ssh -T git@github.com
发现报错:
ssh: connect to host github.com port 22: Connection timed out
端口连接超时。
查阅资料后,找到解决办法:
- Host github.com
- User YourEmail(你的邮箱)
- Hostname ssh.github.com
- PreferredAuthentications publickey
- IdentityFile ~/.ssh/id_rsa
- Port 443
ssh -T git@github.com
会出现以下提示,输入yes回车即可
- The authenticity of host '[ssh.github.com]:443 ([192.30.255.123]:443)' can't be established.
- RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
- Are you sure you want to continue connecting (yes/no)? yes
- Warning: Permanently added '[ssh.github.com]:443,[192.30.255.123]:443' (RSA) to the list of known hosts.
再次执行ssh -T git@github.com,发现验证通过
Hi Clare! You've successfully authenticated, but GitHub does not provide shell access.
完成以上步骤后,再次上传代码到GitHub就不会报错了
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。