Github突然连接不上

标签 git github

My github suddenly failed to connect 

$ git push
ssh: connect to host github.com port 22: Connection refused
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

尝试过

$ ssh -T -p 443 git@ssh.github.com
Hi alinbxSorcerer! You've successfully authenticated, but GitHub does not provide shell access.

有什么问题,多年来一直运行良好。

最佳答案

也许您所在的网络阻塞了端口 22。

设置 ssh 从现在起始终为 Github 使用端口 443:

将以下内容添加到您的 .ssh/config 文件中:

Host github.com
  Hostname ssh.github.com
  Port 443

另一个选项是切换到使用 https 存储库 url,但我觉得时不时地输入密码很烦人。

更多信息:https://help.github.com/en/github/authenticating-to-github/using-ssh-over-the-https-port

关于Github突然连接不上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59172528/

相关文章:

git - 创建 git repo 并将本地目录推送到新初始化的 Azure Repos

ios - 如果点击 iOS 屏幕上的任何其他地方,是否会关闭菜单?

git - 如何将远程存储库添加到我自己的 git 存储库

github - 在 Github Action 中,如何根据上一步的输出条件化步骤?

android - 如何在 Android Studio 中正确使用 Git?

java - TeamCity 和挂起的 Git merge 分支提交保持构建失败的测试

git - 如何确保 Visual Studio Online Git Repository 是私有(private)的?

GIT - 如何在所有分支中保持文件通用

github - 对于 "PTY allocation request failed on channel 0"该怎么办

github - 为 GitHub 中的单个文件夹生成下载链接