SSH(配置文件)和 git clone 没有在正确的端口上连接?

ssh (config file) & git clone not connecting on the the right port?

提问人:coding4fun 提问时间:11/16/2023 更新时间:11/16/2023 访问量:32

问:

所以我在 22 号端口的位置似乎被封锁了。我更改了我的 ssh 配置文件(正如你所知道的,我一直在玩一点):

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

#Host github.com
#  Hostname github.com
#  Port 443

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

当我执行以下操作时,它会按预期工作(以前我会得到连接超时):

ssh -T git@github.com
[email protected]: Permission denied (publickey).

但是当我做一个它仍然试图通过端口连接时:git clone22

git clone [email protected]:<MyUser>/<MyRepo>.git
Cloning into '<MyRep>'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

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

有谁知道为什么它仍然使用 ?仅供参考,我正在使用Windows。port 22git clone

git github ssh

评论

0赞 Brian61354270 11/16/2023
您的 ssh 配置是针对 的,而不是 。ssh.github.comgithub.com
0赞 coding4fun 11/16/2023
@Brian61354270奇怪,我也使用了一些 WSL,所以我在那里尝试过并且它工作正常(配置与我在 WSL 中发布的相同)。我试图把它改成只是从。也许我必须重新启动:P?我确实重新启动了 ssh 服务,所以谁知道:P。github.comssh.github.com

答: 暂无答案