---
title: "挂代理后 git clone 出现 Connection closed by xxxxxxx port 22 的解决办法"
description: "出现这个问题，往往是因为代理的防火墙拒绝了 SSH 连接，可以尝试使用在 HTTPS 端口上建立的 SSH 连接进行克隆。"
canonical_url: "https://yangqiuyi.com/blog/kai-fa/gua-dai-li-hou-git-clone-chu-xian-connection-closed-by-xxxxxxx-port-22-de-jie-jue-ban-fa"
---

> Index of every page on this site: [llms.txt](https://yangqiuyi.com/llms.txt)

# 挂代理后 git clone 出现 Connection closed by xxxxxxx port 22 的解决办法

出现这个问题，往往是因为代理的防火墙拒绝了 SSH 连接，可以尝试使用在 HTTPS 端口上建立的 SSH 连接进行克隆。

参考：[https://docs.github.com/en/authentication/troubleshooting-ssh/using-ssh-over-the-https-port](https://docs.github.com/en/authentication/troubleshooting-ssh/using-ssh-over-the-https-port)

## 解决方案

在 `~/.ssh/config` 里添加：

```text
Host github.com
    Hostname ssh.github.com
    Port 443
    User git
```

## Sitemap

See the full [sitemap](https://yangqiuyi.com/sitemap.md) for all pages.
