首页 > 解决方案 > 无法 SSH -T git@github.com

问题描述

我一直在尝试在我的 PC(Ubuntu 20.04)上使用 SSH(git clone)连接 GitHub。

0. Installed SSH, git
1. Created SSH-key under ~/.SSH/
2. Submit my id_rsa.pub key to GitHub
3. SSH -T git@github.com <- Did not work
4. SSH -vT git@github.com <- Didn't work
6. SSH git@github.com <- It worked
7. git clone ~ <- Did not work

当我执行 SSH -T git@github.com 时,它不起作用。

Error Messages:
Connection to github.com closed by remote host.

fatal: Could not read from remote repository.

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

终端显示“远程主机关闭与 github.com 的连接”

但是当我尝试 SSH git@github.com 时,它可以工作并且终端显示 Hi, username =。

然后我尝试了 git clone (我的 GitHub 存储库),但终端说“请确保您有正确的访问权限~”。

我的 SSH 连接有什么问题?

标签: gitgithubssh

解决方案


请注意(对于其他读者)路径是区分大小写的(除非您在 Windows 上),这意味着 SSH 密钥在 下~/.ssh,而不是~/.SSH

URL 应该是:

git clone git@github.com:<user>/<reponame>

同样,区分大小写:仔细检查远程存储库的 URL。


推荐阅读