github git push 失效问题
以前推代码到github.com都比较正常,最近几天无论如何都不成功,一直超时,在互联网上搜索了大半天,终于才找到一篇文章解决问题。原文参考:https://bengsfort.github.io/articles/fixing-git-push-pull-timeout/。github文档参考:https://docs.github.com/en/authentication/troubleshooting-ssh/using-ssh-over-the-https-port。
设置之前:
$ git push -v
ssh: connect to host github.com port 22: Operation timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
一直超时。
ssh测试:
$ ssh -T git@github.com
也是如此。
$ ssh -T -p 443 git@ssh.github.com
测试通过
修改~/.ssh/config:
Host github.com
Hostname ssh.github.com
Port 443
终于成功!
2024-02-13编辑:
或者检查ssh-agent:
killall ssh-agent; eval `ssh-agent`

浙公网安备 33010602011771号