How to fix fatal: unable to access: Could not resolve proxy: proxy.example.com in Git

GitBEGINNERMEDIUMUpdated Dec 6, 2025· 191 views

This error occurs when Git tries to connect through a proxy server that doesn't exist or can't be reached. The fix typically involves removing outdated proxy settings from Git config or environment variables, or correcting the proxy address if you're actually behind a proxy.

Quick fix

Fixes fatal: unable to access: Could not resolve proxy: proxy.example.com

# Check Git's global proxy configuration
git config --global --get http.proxy
git config --global --get https.proxy

# Check system-level proxy (if set)
git config --system --get http.proxy
git config --system --get https.proxy

# Check local repository proxy (if in a repo)
git config --local --get http.proxy
git config --local --get https.proxy

# List all proxy-related config
git config --global --list | grep -i proxy
  1. Check your current proxy settings
  2. Remove proxy settings from Git config
  3. Unset proxy environment variables
  4. Test your Git connection
git — error
# Check Git's global proxy configuration
git config --global --get http.proxy
git config --global --get https.proxy
# Check system-level proxy (if set)
git config --system --get http.proxy
git config --system --get https.proxy
# Check local repository proxy (if in a repo)
git config --local --get http.proxy
git config --local --get https.proxy
# List all proxy-related config
git config --global --list | grep -i proxy
fatal: unable to access: Could not resolve proxy: proxy.example.com

What this error means

This error indicates that Git attempted to route your request through a proxy server, but the proxy hostname could not be resolved to an IP address. This is a DNS resolution failure for the proxy itself, not for the remote Git repository. When you run Git commands that access remote repositories (clone, fetch, push, pull), Git checks for proxy configuration in multiple places: the `http.proxy` and `https.proxy` Git config settings, and the `HTTP_PROXY`, `HTTPS_PROXY`, `http_proxy`, and `https_proxy` environment variables. If any of these contain a proxy address that doesn't exist on your current network, Git will fail with this error. This commonly happens when you've previously configured a proxy (perhaps at work, a hotel, or on an airplane WiFi) and then moved to a different network where that proxy isn't available. The proxy setting persists even though you're no longer on the network that required it.

Typical symptoms

  • Git clone, fetch, push, or pull commands fail with 'Could not resolve proxy'
  • Error mentions a proxy hostname you don't recognize or no longer use
  • Git operations work from some networks but not others
  • Browser can access GitHub/GitLab but Git commands fail
  • CI/CD pipelines fail at git operations with proxy errors
  • Error appeared after switching networks or VPN connections
  • Same repository works on other machines but not this one
  • Error only appears for HTTP/HTTPS remotes, not SSH

Common causes

  1. Proxy configured in Git config but you're no longer on that network
  2. HTTP_PROXY or HTTPS_PROXY environment variable set to a non-existent proxy
  3. Corporate proxy settings persisted after leaving the office network
  4. Proxy was auto-configured during captive portal login (hotel, airport WiFi)
  5. System-wide proxy settings affecting Git
  6. Typo in the proxy hostname configuration
  7. Proxy server is down or unreachable
  8. DNS cannot resolve the proxy hostname
  9. VPN disconnected but proxy settings remain

How to fix "fatal: unable to access: Could not resolve proxy: proxy.example.com"

1Check your current proxy settings

First, identify what proxy settings Git is using:

bash
# Check Git's global proxy configuration
git config --global --get http.proxy
git config --global --get https.proxy

# Check system-level proxy (if set)
git config --system --get http.proxy
git config --system --get https.proxy

# Check local repository proxy (if in a repo)
git config --local --get http.proxy
git config --local --get https.proxy

# List all proxy-related config
git config --global --list | grep -i proxy

Also check environment variables:

bash
# Check environment variables (Linux/macOS)
echo $HTTP_PROXY
echo $HTTPS_PROXY
echo $http_proxy
echo $https_proxy

# On Windows (Command Prompt)
echo %HTTP_PROXY%
echo %HTTPS_PROXY%

If any of these show a proxy address that you don't need, proceed to remove it.

2Remove proxy settings from Git config

If you're NOT behind a proxy and don't need one, unset all proxy configurations:

bash
# Remove global proxy settings
git config --global --unset http.proxy
git config --global --unset https.proxy

# Remove system-level proxy settings (may require admin/sudo)
git config --system --unset http.proxy
git config --system --unset https.proxy

# Remove local repository proxy settings (run inside the repo)
git config --local --unset http.proxy
git config --local --unset https.proxy

If you see "warning: http.proxy has multiple values":

bash
# Remove all proxy values at once
git config --global --unset-all http.proxy
git config --global --unset-all https.proxy

Verify the settings are removed:

bash
git config --global --list | grep -i proxy
# Should return nothing
3Unset proxy environment variables

Remove proxy environment variables for the current session:

bash
# Linux/macOS
unset HTTP_PROXY
unset HTTPS_PROXY
unset http_proxy
unset https_proxy
unset ALL_PROXY
unset all_proxy

# Verify they're unset
env | grep -i proxy

On Windows (Command Prompt):

cmd
set HTTP_PROXY=
set HTTPS_PROXY=
set http_proxy=
set https_proxy=

On Windows (PowerShell):

powershell
Remove-Item Env:HTTP_PROXY -ErrorAction SilentlyContinue
Remove-Item Env:HTTPS_PROXY -ErrorAction SilentlyContinue
Remove-Item Env:http_proxy -ErrorAction SilentlyContinue
Remove-Item Env:https_proxy -ErrorAction SilentlyContinue

To make this permanent, remove proxy exports from your shell configuration file (~/.bashrc, ~/.zshrc, ~/.bash_profile):

bash
# Open your shell config and remove any lines like:
# export HTTP_PROXY=...
# export HTTPS_PROXY=...
nano ~/.bashrc
# or
nano ~/.zshrc
4Test your Git connection

After removing proxy settings, verify Git can connect:

bash
# Test a simple clone
git clone https://github.com/octocat/Hello-World.git /tmp/test-repo

# Or test fetch on an existing repo
cd your-repository
git fetch origin

# For detailed connection debugging
GIT_TRACE=1 GIT_CURL_VERBOSE=1 git fetch origin

If the operation succeeds, the proxy issue is resolved.

5Configure proxy correctly (if you need one)

If you ARE behind a corporate proxy and need to configure it properly:

bash
# Set HTTP proxy
git config --global http.proxy http://proxy.example.com:8080

# Set HTTPS proxy (note: still uses http:// in the value)
git config --global https.proxy http://proxy.example.com:8080

With authentication:

bash
git config --global http.proxy http://username:password@proxy.example.com:8080
git config --global https.proxy http://username:password@proxy.example.com:8080

Important: Always include the http:// prefix, even for the https.proxy setting.

Proxy for specific domains only:

bash
# Only use proxy for github.com
git config --global http.https://github.com.proxy http://proxy.example.com:8080

# No proxy for internal Git servers
git config --global http.https://internal-git.company.com.proxy ""

Or set environment variables:

bash
# Add to ~/.bashrc or ~/.zshrc
export http_proxy=http://proxy.example.com:8080
export https_proxy=http://proxy.example.com:8080
export no_proxy=localhost,127.0.0.1,.company.com
6Check DNS resolution

If the proxy hostname should be valid, verify DNS is working:

bash
# Test DNS resolution of the proxy
nslookup proxy.example.com

# Or use dig
dig proxy.example.com

# Test general DNS resolution
nslookup github.com

If DNS is not resolving:

1. Check your network connection
2. Try using public DNS servers:
- Google: 8.8.8.8, 8.8.4.4
- Cloudflare: 1.1.1.1, 1.0.0.1

bash
# Temporary DNS test (Linux)
nslookup proxy.example.com 8.8.8.8

On Windows, flush DNS cache:

cmd
ipconfig /flushdns

On macOS:

bash
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

On Linux:

bash
sudo systemd-resolve --flush-caches
# Or for older systems
sudo /etc/init.d/nscd restart
7Reset network settings (Windows)

On Windows, resetting the TCP/IP stack can resolve persistent proxy issues:

Run as Administrator:

cmd
netsh winsock reset
netsh int ip reset
ipconfig /release
ipconfig /renew
ipconfig /flushdns

Restart your computer after running these commands.

Also check Windows proxy settings:

1. Open Settings > Network & Internet > Proxy
2. Disable "Use a proxy server" under Manual proxy setup
3. Disable "Automatically detect settings" if it's causing issues

For WSL (Windows Subsystem for Linux):

WSL inherits proxy settings from Windows. If you're having issues:

bash
# In WSL, check /etc/resolv.conf
cat /etc/resolv.conf

# If it points to a non-working DNS, you may need to reset WSL
# From PowerShell (as admin):
wsl --shutdown

# Then restart WSL

Advanced notes

### Understanding Proxy Configuration Precedence

Git checks for proxy settings in this order (highest priority first):

1. Remote-specific config: http.<url>.proxy
2. Environment variables: https_proxy, HTTPS_PROXY, http_proxy, HTTP_PROXY, all_proxy, ALL_PROXY
3. Git config: http.proxy, https.proxy (local > global > system)

If you've set a proxy in multiple places, you need to clear all of them.

### Case Sensitivity of Environment Variables

- Linux/macOS: Environment variables are case-sensitive. HTTP_PROXY and http_proxy are different.
- Windows: Environment variables are case-insensitive.
- curl/libcurl (which Git uses): Prefers lowercase (http_proxy, https_proxy).

For maximum compatibility, unset both uppercase and lowercase variants.

### NO_PROXY for Bypassing Proxy

If you need a proxy for most things but want to bypass it for specific hosts:

bash
export no_proxy=localhost,127.0.0.1,.internal.company.com,192.168.*

This is useful when you have an internal Git server that shouldn't go through the corporate proxy.

### Debugging Proxy Issues

Enable verbose Git and curl output:

bash
GIT_TRACE=1 GIT_CURL_VERBOSE=1 git clone https://github.com/user/repo.git

Look for lines containing:
- Proxy - shows what proxy Git is trying to use
- CONNECT - shows proxy tunnel attempts
- getaddrinfo or resolve - shows DNS lookups

### Git Config File Locations

If command-line unset doesn't work, manually edit the config files:

bash
# Global config
~/.gitconfig

# System config (may require sudo)
/etc/gitconfig           # Linux
C:\Program Files\Git\etc\gitconfig  # Windows

# Local repo config
.git/config

Look for and remove sections like:

ini
[http]
    proxy = http://proxy.example.com:8080
[https]
    proxy = http://proxy.example.com:8080

### SOCKS Proxy Configuration

If you're using a SOCKS proxy instead of HTTP proxy:

bash
# SOCKS5 proxy
git config --global http.proxy socks5://127.0.0.1:1080

# SOCKS5 with DNS resolution through proxy
git config --global http.proxy socks5h://127.0.0.1:1080

The socks5h:// variant routes DNS queries through the proxy as well.

### Corporate Proxy with NTLM Authentication

For Windows domain authentication:

bash
# Use cntlm as a local proxy that handles NTLM
# Install cntlm, configure it, then:
git config --global http.proxy http://localhost:3128

### Proxy Auto-Configuration (PAC) Files

Git doesn't directly support PAC files. If your network uses PAC:

1. Find the actual proxy server from the PAC file
2. Configure Git to use that proxy directly
3. Or use a tool like pacrunner to resolve PAC files

### SSH Doesn't Use HTTP Proxy

If you're having persistent proxy issues with HTTPS, consider switching to SSH:

bash
# Change remote from HTTPS to SSH
git remote set-url origin git@github.com:user/repo.git

SSH connections don't use HTTP proxy settings (though they can be configured separately in ~/.ssh/config if needed).

Frequently asked questions

What does "fatal: unable to access: Could not resolve proxy: proxy.example.com" mean?
This error indicates that Git attempted to route your request through a proxy server, but the proxy hostname could not be resolved to an IP address. This is a DNS resolution failure for the proxy itself, not for the remote Git repository. proxy Git config settings, and the HTTP_PROXY, HTTPS_PROXY, http_proxy, and https_proxy environment variables.
How do I fix "fatal: unable to access: Could not resolve proxy: proxy.example.com"?
This error occurs when Git tries to connect through a proxy server that doesn't exist or can't be reached. The fix typically involves removing outdated proxy settings from Git config or environment variables, or correcting the proxy address if you're actually behind a proxy.
What causes "fatal: unable to access: Could not resolve proxy: proxy.example.com"?
Proxy configured in Git config but you're no longer on that network HTTP_PROXY or HTTPS_PROXY environment variable set to a non-existent proxy Corporate proxy settings persisted after leaving the office network
Is the "fatal: unable to access: Could not resolve proxy: proxy.example.com" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading