之前都好好的,今天git push
突然出现这个问题
解决方法一:改用HTTP协议(我没试过,应该是可以的)文章来源:https://www.toymoban.com/news/detail-807892.html
- 就是把远程库地址改成HTTP协议的,好像是这个命令,自己搜一下
git remote set-url origin https://username@github.com/username/repository.git
解决方法二:更改SSH端口(亲测可用)文章来源地址https://www.toymoban.com/news/detail-807892.html
- 先试试这个命令
ssh -T -p 443 git@ssh.github.com
- 此时出现如下提示信息
The authenticity of host '[ssh.github.com]:443 ([20.205.243.160]:443)' can't be established. ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU. This host key is known by the following other names/addresses: ~/.ssh/known_hosts:1: github.com Are you sure you want to continue connecting (yes/no/[fingerprint])?
- 输入
yes
,然后如果出现下面这个提示Hi 你的github用户名
,则443端口连接成功Warning: Permanently added '[ssh.github.com]:443' (ED25519) to the list of known hosts. Hi youname! You've successfully authenticated, but GitHub does not provide shell access.
- 在
C:\Users\your-username\.ssh\
目录下创建config文件,输入
Host github.com
HostName ssh.github.com
Port 443
-
git push
或者git pull
应该就成功了
到了这里,关于$ git push ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!