# stderr: fatal: unable to access 'https://github.com/org/repo.git/': Could not resolve host: github.com

- **ID:** `cicd/jenkins-pipeline-git-checkout-failed`
- **Domain:** cicd
- **Category:** network_error
- **Error Code:** `JENKINS_GIT_DNS`
- **Verification:** ai_generated
- **Fix Rate:** 82%

## Root Cause

Jenkins pipeline fails to clone a Git repository because the Jenkins agent cannot resolve the hostname due to DNS misconfiguration, network proxy settings, or the agent being in a restricted network environment.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Jenkins 2.440.x | active | — | — |
| Jenkins 2.450.x | active | — | — |
| Git plugin 5.2.x | active | — | — |

## Workarounds

1. **Configure the Jenkins agent to use a specific DNS server by setting JVM arguments: `-Djava.security.policy=/path/to/policy -Dnetworkaddress.cache.ttl=60` and ensure the agent's `/etc/resolv.conf` contains valid DNS servers like `8.8.8.8`.** (85% success)
   ```
   Configure the Jenkins agent to use a specific DNS server by setting JVM arguments: `-Djava.security.policy=/path/to/policy -Dnetworkaddress.cache.ttl=60` and ensure the agent's `/etc/resolv.conf` contains valid DNS servers like `8.8.8.8`.
   ```
2. **If behind a proxy, configure Git to use the proxy: `git config --global http.proxy http://proxy.example.com:8080` and `git config --global https.proxy http://proxy.example.com:8080` in the pipeline script before checkout.** (80% success)
   ```
   If behind a proxy, configure Git to use the proxy: `git config --global http.proxy http://proxy.example.com:8080` and `git config --global https.proxy http://proxy.example.com:8080` in the pipeline script before checkout.
   ```

## Dead Ends

- **** — Adding `github.com` to the `/etc/hosts` file on the agent may work temporarily but fails if the IP address changes, and does not address the root cause of DNS resolution failure. (70% fail)
- **** — Changing the Git URL from HTTPS to SSH does not resolve DNS issues; SSH also requires hostname resolution and may introduce additional authentication failures. (80% fail)
