是什么

GitHub Enterprise Server(GHES)支持让组织将 Claude Code 与自托管的 GitHub 实例连接,无需使用 github.com。管理员一次性配置后,开发者即可在 GHES 仓库上使用 Web 会话、自动代码审查和插件市场,无需额外配置。适用于 Team 和 Enterprise 计划。

核心机制

管理员一次性设置:通过引导式流程在 GHES 实例上创建 GitHub App,Claude Code 自动存储凭证。开发者克隆 GHES 仓库后,Claude Code 从 git remote 自动检测 GHES 主机名。

支持的功能:Web 会话、Code Review、Teleport 会话迁移、插件市场、贡献度指标、GitHub Actions(需手动配置 workflow)。不支持 GitHub MCP Server(用 gh CLI 替代)。

插件市场差异:GHES 托管的市场需使用完整 git URL,不能用 owner/repo 简写:

/plugin marketplace add git@github.example.com:platform/claude-plugins.git

网络要求:GHES 实例必须能被 Anthropic 基础设施访问(用于克隆仓库和发布审查评论),需在防火墙中放行 Anthropic API IP 地址。

手动设置备选:如果引导式重定向被网络阻断,可手动创建 GitHub App 并填入凭证(hostname、OAuth client ID/secret、App ID、webhook secret、private key)。

关键细节

  • 管理员设置入口:claude.ai/admin-settings/claude-code
  • 开发者工作流:git clone git@github.example.com:org/repo.git && claude --remote "..."
  • Teleport 到本地:claude --teleport
  • 管理员限制市场来源:hostPattern 配置
  • 预注册市场:extraKnownMarketplaces 配置

关联

实践要点

  • 支持自签名证书,在设置时粘贴 CA 证书
  • GitHub MCP Server 不支持 GHES,改用 gh auth login --hostname github.example.com
  • 克隆失败时检查:GHES 实例是否已连接、GitHub App 是否安装到该仓库
  • 市场添加被策略阻止时,联系管理员在 managed settings 中添加 hostPattern