# 错误：无法连接到 github.com 端口 443：连接超时

- **ID:** `cicd/github-actions-connect-timeout`
- **领域:** cicd
- **类别:** network_error
- **错误码:** `CONNECTION_TIMEOUT`
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

GitHub Actions 运行器无法访问 github.com，原因是运行器环境中的 DNS 解析失败、防火墙规则或代理配置错误。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| GitHub Actions Runner 2.308.0 | active | — | — |
| Ubuntu 22.04 | active | — | — |
| Windows Server 2022 | active | — | — |

## 解决方案

1. ```
   Configure proxy environment variables on the runner: export http_proxy=http://proxy.example.com:8080; export https_proxy=http://proxy.example.com:8080; export no_proxy=localhost,127.0.0.1
   ```
2. ```
   Update DNS resolver on the runner host: echo 'nameserver 8.8.8.8' > /etc/resolv.conf
   ```
3. ```
   Check firewall rules to allow outbound HTTPS (port 443) to github.com IP ranges: nslookup github.com; sudo ufw allow out on eth0 to any port 443 proto tcp
   ```

## 无效尝试

- **Restarting the runner service without checking network connectivity** — The underlying network issue persists after restart; runner will hit the same timeout on next job. (95% 失败率)
- **Adding more retries via workflow configuration (e.g., 'retry-on-error: true')** — GitHub Actions retries only the step, not the underlying TCP connection; connection timeout is fatal and not recoverable by retrying the step. (90% 失败率)
- **Clearing runner cache and reinstalling the runner agent** — The runner agent itself is functional; the issue is at the network layer, not the agent software. (85% 失败率)
