# GHE.com 的网络详细信息

确保客户端系统可以访问你的 GHE.com资源。

要在 GHE.com 上访问你的企业，客户端系统必须：

* 信任 GitHub的 SSH 密钥指纹
* 有权访问 GitHub'主机名和 IP 地址

## GitHub's SSH 密钥指纹

若要查找这些详细信息，请使用实例的 `/meta` API 终结点。 例如，使用 GitHub CLI：

```shell
gh api /meta --hostname octocorp.ghe.com
```

有关详细信息，请参阅“[元数据的 REST API 端点](/zh/enterprise-cloud@latest/rest/meta/meta)”。

## 使用包含 GHE.com 的 SSH 连接

若要使用 Git over SSH 从 `SUBDOMAIN.ghe.com` 克隆存储库，其中 SUBDOMAIN 是企业的专用子域 GHE.com，请使用 SUBDOMAIN 作为 SSH 用户名，而不是将 `git` 用作 SSH 用户名。

```shell
git clone SUBDOMAIN@SUBDOMAIN.ghe.com:OWNER/REPO.git
```

## GitHub的主机名

* `*.SUBDOMAIN.ghe.com`，其中 SUBDOMAIN 是企业专用的子域名 GHE.com
* `*.pages.SUBDOMAIN.ghe.com`
* `*.actions.SUBDOMAIN.ghe.com`
* `*.githubassets.com`
* `*.githubusercontent.com`
* `*.blob.core.windows.net`。 如果不允许访问通配符域，请参阅[Azure Blob 存储主机名](#azure-blob-storage-hostnames)。
* `auth.ghe.com`

### Azure Blob 存储主机名

如果无法访问`*.blob.core.windows.net`，请使用`/meta`企业 API 终结点检索面向客户端Azure Blob 存储主机名的完整列表。 例如，使用 GitHub CLI：

```shell
gh api /meta --hostname octocorp.ghe.com --jq '.domains.storage[]'
```

允许访问在 .. 中 `domains.storage`返回的每个主机名。 该列表特定于你的企业，随着 GitHub 网络要求的变化，它会保持最新状态。

有关终结点的详细信息 `/meta` ，请参阅 [元数据的 REST API 端点](/zh/enterprise-cloud@latest/rest/meta/meta#get-github-meta-information)。

> \[!NOTE]
> 如果将审核日志流式传输到自己的Azure Blob 存储目标，则必须允许单独访问该目标。

## GitHub 的 IP 地址

GitHub 上针对企业的 GHE.com IP 地址范围取决于你选择的区域。

### 欧盟

| 出口流量范围            | 入口流量范围             |
| ----------------- | ------------------ |
| 108.143.221.96/28 | 108.143.197.176/28 |
| 20.61.46.32/28    | 20.123.213.96/28   |
| 20.224.62.160/28  | 20.224.46.144/28   |
| 51.12.252.16/28   | 20.240.194.240/28  |
| 74.241.131.48/28  | 20.240.220.192/28  |
| 20.240.211.176/28 | 20.240.211.208/28  |

### 澳大利亚

| 出口流量范围           | 入口流量范围            |
| ---------------- | ----------------- |
| 20.5.34.240/28   | 4.237.73.192/28   |
| 20.5.146.128/28  | 20.5.226.112/28   |
| 68.218.155.16/28 | 20.248.163.176/28 |

### 美国

| 出口流量范围             | 入口流量范围             |
| ------------------ | ------------------ |
| 20.221.76.128/28   | 74.249.180.192/28  |
| 135.233.115.208/28 | 48.214.149.96/28   |
| 20.118.27.192/28   | 172.202.123.176/28 |

### 日本

| 出口流量范围           | 入口流量范围           |
| ---------------- | ---------------- |
| 74.226.88.192/28 | 74.226.88.240/28 |
| 40.81.180.112/28 | 40.81.176.224/28 |
| 4.190.169.192/28 | 4.190.169.240/28 |

## GitHub Copilot

大多数 GitHub Copilot 服务都需要访问企业子域 GHE.com 及其子域。 有关详细信息，请参阅“[Copilot 允许列表参考](/zh/enterprise-cloud@latest/copilot/reference/copilot-allowlist-reference#copilot-on-ghecom)”。

## Azure专用网络支持的区域

GitHub 将运行器部署在与所连接子网相同的 Azure 区域中。 因此，子网必须位于支持的区域之一。 如果将Azure专用网络用于 GitHub 托管的运行程序，则 GHE.com 上支持的Azure区域不同于 GitHub.com 上的区域。

### 欧盟支持的区域

| 运行程序类型                                                             | 支持的区域 |
| ------------------------------------------------------------------ | ----- |
| X64                                                                |       |
| `francecentral`、`swedencentral`、`germanywestcentral`、`northeurope` |       |
| arm64                                                              |       |
| `francecentral`、`northeurope`、`germanywestcentral`                 |       |
| GPU                                                                |       |
| `italynorth`、`swedencentral`                                       |       |

### 澳大利亚支持的区域

| 运行程序类型                             | 支持的区域 |
| ---------------------------------- | ----- |
| X64                                |       |
| `australiaeast`、`australiacentral` |       |
| arm64                              |       |
| `australiaeast`、`australiacentral` |       |
| GPU                                |       |
| `australiaeast`、`australiacentral` |       |

### 在美国支持的区域

| 运行程序类型                          | 支持的区域 |
| ------------------------------- | ----- |
| X64                             |       |
| `centralus`、`eastus2`、`westus3` |       |
| arm64                           |       |
| `centralus`、`eastus2`、`westus3` |       |
| GPU                             |       |
| `centralus`、`eastus2`、`westus3` |       |

### 日本支持的区域

| 运行程序类型                  | 支持的区域       |
| ----------------------- | ----------- |
| X64                     |             |
| `japaneast`、`japanwest` |             |
| arm64                   |             |
| `japaneast`、`japanwest` |             |
| GPU                     | `japaneast` |

### Azure专用网络的 IP 范围

#### EU

操作 IP：

* 74.241.192.231
* 20.4.161.108
* 74.241.204.117
* 20.31.193.160

欧盟区域：

* 108.143.197.176/28
* 108.143.197.160/28
* 20.123.213.96/28
* 20.123.214.144/28
* 20.224.46.144/28
* 20.224.46.160/28
* 20.240.194.240/28
* 20.240.194.224/28
* 20.240.220.192/28
* 20.240.220.176/28
* 20.240.211.208/28
* 20.240.211.224/28

#### 澳大利亚

操作 IP：

* 4.147.140.77
* 20.53.114.78

澳大利亚区域：

* 4.237.73.144/28
* 4.237.73.192/28
* 20.5.226.96/28
* 20.5.226.112/28
* 20.248.163.160/28
* 20.248.163.176/28

#### 日本

操作 IP：

* 20.63.233.164
* 172.192.153.164

日本区域：

* 74.226.88.240/28
* 74.226.88.224/28
* 40.81.176.224/28
* 40.81.178.160/28
* 4.190.169.240/28
* 4.190.170.0/28

#### 所有区域均必需

* `Storage` 服务标记
* github.com 的通信要求
  * 192.30.252.0/22
  * 185.199.108.0/22
  * 140.82.112.0/20
  * 143.55.64.0/20
  * 20.201.28.151/32
  * 20.205.243.166/32
  * 20.87.245.0/32
  * 4.237.22.38/32
  * 20.207.73.82/32
  * 20.27.177.113/32
  * 20.200.245.247/32
  * 20.175.192.147/32
  * 20.233.83.145/32
  * 20.29.134.23/32
  * 20.199.39.232/32
  * 20.217.135.5/32
  * 4.225.11.198/32
  * 4.208.26.197/32
  * 20.26.156.215/32

### 用于 Azure 私有网络的域

#### 所有区域均必需

* `*.<TENANT>.ghe.com`
* `<TENANT>.ghe.com`
* `github.com`
* `*.githubusercontent.com`
* `*.blob.core.windows.net`。 若要仅允许访问企业使用的主机名，请参阅[Azure Blob 存储主机名](#azure-blob-storage-hostnames)。
* `*.web.core.windows.net`

### 用于连接 Azure 计费订阅的 OAuth 回调 URL

连接或更新Azure订阅进行计费时，必须允许访问以下 URL：

* `https://github.com/enterprises/oauth_callback`

在以下情况下发生的 OAuth 身份验证流中，需要此 URL：

* 首次将 Azure 订阅连接到企业
* 更改或更新现有Azure订阅连接

> \[!IMPORTANT]
>
> * URL 必须允许所有查询参数，例如 `https://github.com/enterprises/oauth_callback?code=...`
> * 成功连接Azure订阅并存储订阅 ID 后，可以从允许列表中删除此 URL
> * 若要更改或更新Azure订阅，必须将 URL 添加回允许列表

OAuth 流的工作原理如下：

1. 用户在`SUBDOMAIN.ghe.com`启动连接过程
2. Azure重定向到 `https://github.com/enterprises/oauth_callback`以完成 OAuth 流
3. 系统重定向回 `SUBDOMAIN.ghe.com` 以完成连接

## GitHub Enterprise Importer 的 IP 范围

\*\* 如果您使用GitHub Enterprise Importer进行企业迁移，则可能需要将某些范围添加到 IP 允许列表中。 请参阅“[管理 GitHub 产品之间迁移的访问权限](/zh/enterprise-cloud@latest/migrations/using-github-enterprise-importer/migrating-between-github-products/managing-access-for-a-migration-between-github-products#configuring-ip-allow-lists-for-migrations)”。