# 错误：检出失败：无法解析主机名 github.com：名称或服务未知

- **ID:** `cicd/jenkins-pipeline-checkout-failed`
- **领域:** cicd
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

Jenkins 流水线因 DNS 解析失败、网络配置错误或构建环境中的代理问题而无法解析 Git 主机名。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Jenkins 2.440 | active | — | — |
| Git plugin 5.2.0 | active | — | — |
| Alpine Linux 3.18 | active | — | — |

## 解决方案

1. ```
   Configure DNS servers explicitly in the Jenkins agent's /etc/resolv.conf or set the DNS in Docker if using containers: echo 'nameserver 8.8.8.8' >> /etc/resolv.conf
   ```
2. ```
   If behind a proxy, set the proxy environment variables in the Jenkins node configuration: export http_proxy=http://proxy:8080; export https_proxy=http://proxy:8080
   ```

## 无效尝试

- **** — Restarting Jenkins only restarts the master; it doesn't fix DNS resolution in build agents unless they are restarted separately. (50% 失败率)
- **** — Pinging github.com from the master doesn't guarantee the agent can resolve it; agents may have different DNS settings. (60% 失败率)
