GitHub CLI 2.100.0
新功能 1 項
GitHub API 流量支援自訂閘道,身分驗證與網址維持直連
企業若需要稽核或集中管控網路流量,現在可以透過個別主機的 api_host 設定,將 GitHub API 請求導向自訂閘道(gateway,把流量轉去另一個位址再送出的中繼點)。這項改動只會轉發 API 呼叫,登入身分驗證、Git 遠端儲存庫操作與瀏覽器開啟網址仍會直接連線至原始主機。此功能目前仍處於實驗階段,且不是安全邊界,部分請求可能依然會送往原始主機。
``` # 設定將 github.com 的 API 流量轉發至自訂閘道 gh config set api_host gh-gateway.example.com --host github.com
# 查詢特定主機目前設定的 API 閘道位址 gh config get api_host --host github.com ```
這就像公司設立的公務收發室,員工採購與查詢資料等業務公文統一由專屬窗口轉交處理,但員工出勤打卡、私人包裹寄送與親自拜訪仍直接走大樓正門。
官方原文
## Experimental: Route GitHub API traffic through a custom host
Organizations can now route a GitHub host's API traffic through a gateway using the new per-host api_host configuration:
```shell
# Route API traffic for github.com through a gateway
gh config set api_host gh-gateway.example.com --host github.com
# Read the configured API host
gh config get api_host --host github.com
```
The original host remains in use for authentication, Git remotes, and browser URLs.
> [!NOTE]
> api_host is experimental and is not a security boundary. Requests may still reach the original host.