How to fix fatal: unable to access: Could not resolve proxy: proxy.example.com in Git
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- Check your current proxy settings
- Remove proxy settings from Git config
- Unset proxy environment variables
- Test your Git connection
# Check Git's global proxy configurationgit config --global --get http.proxygit config --global --get https.proxy# Check system-level proxy (if set)git config --system --get http.proxygit config --system --get https.proxy# Check local repository proxy (if in a repo)git config --local --get http.proxygit config --local --get https.proxy# List all proxy-related configgit config --global --list | grep -i proxyfatal: 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
- 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
- Proxy was auto-configured during captive portal login (hotel, airport WiFi)
- System-wide proxy settings affecting Git
- Typo in the proxy hostname configuration
- Proxy server is down or unreachable
- DNS cannot resolve the proxy hostname
- VPN disconnected but proxy settings remain
How to fix "fatal: unable to access: Could not resolve proxy: proxy.example.com"
First, identify what proxy settings Git is using:
# 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 proxyAlso check environment variables:
# 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.
If you're NOT behind a proxy and don't need one, unset all proxy configurations:
# 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.proxyIf you see "warning: http.proxy has multiple values":
# Remove all proxy values at once
git config --global --unset-all http.proxy
git config --global --unset-all https.proxyVerify the settings are removed:
git config --global --list | grep -i proxy
# Should return nothingRemove proxy environment variables for the current session:
# 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 proxyOn Windows (Command Prompt):
set HTTP_PROXY=
set HTTPS_PROXY=
set http_proxy=
set https_proxy=On Windows (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 SilentlyContinueTo make this permanent, remove proxy exports from your shell configuration file (~/.bashrc, ~/.zshrc, ~/.bash_profile):
# Open your shell config and remove any lines like:
# export HTTP_PROXY=...
# export HTTPS_PROXY=...
nano ~/.bashrc
# or
nano ~/.zshrcAfter removing proxy settings, verify Git can connect:
# 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 originIf the operation succeeds, the proxy issue is resolved.
If you ARE behind a corporate proxy and need to configure it properly:
# 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:8080With authentication:
git config --global http.proxy http://username:password@proxy.example.com:8080
git config --global https.proxy http://username:password@proxy.example.com:8080Important: Always include the http:// prefix, even for the https.proxy setting.
Proxy for specific domains only:
# 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:
# 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.comIf the proxy hostname should be valid, verify DNS is working:
# Test DNS resolution of the proxy
nslookup proxy.example.com
# Or use dig
dig proxy.example.com
# Test general DNS resolution
nslookup github.comIf 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
# Temporary DNS test (Linux)
nslookup proxy.example.com 8.8.8.8On Windows, flush DNS cache:
ipconfig /flushdnsOn macOS:
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponderOn Linux:
sudo systemd-resolve --flush-caches
# Or for older systems
sudo /etc/init.d/nscd restartOn Windows, resetting the TCP/IP stack can resolve persistent proxy issues:
Run as Administrator:
netsh winsock reset
netsh int ip reset
ipconfig /release
ipconfig /renew
ipconfig /flushdnsRestart 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:
# 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 WSLAdvanced 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:
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:
GIT_TRACE=1 GIT_CURL_VERBOSE=1 git clone https://github.com/user/repo.gitLook 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:
# Global config
~/.gitconfig
# System config (may require sudo)
/etc/gitconfig # Linux
C:\Program Files\Git\etc\gitconfig # Windows
# Local repo config
.git/configLook for and remove sections like:
[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:
# 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:1080The socks5h:// variant routes DNS queries through the proxy as well.
### Corporate Proxy with NTLM Authentication
For Windows domain authentication:
# 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:
# Change remote from HTTPS to SSH
git remote set-url origin git@github.com:user/repo.gitSSH 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
- 📚Git Official Documentation
- 💬Stack Overflow - Git: Could not resolve proxy(Stack Overflow)
- 💬Stack Overflow - Git: How to remove proxy(Stack Overflow)
- 💬Stack Overflow - git clone can't resolve proxy(Stack Overflow)
- 📖GitHub Gist - Configure Git to use a proxy(Official Docs)
- 📖Git Documentation - git-config(Official Docs)
- 📖GeeksforGeeks - Getting Git To Work With a Proxy Server(Official Docs)