Git
Proxy Server
Network Timeout
Troubleshooting
Tech Solutions

Getting Git to work with a proxy server - fails with Request timed out

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Introduction

Git timeout errors behind a proxy usually come from mismatched proxy settings, authentication gaps, or TLS inspection rules. The message "Request timed out" is generic, so a structured diagnosis is important. This guide gives a repeatable workflow for HTTP and HTTPS Git traffic in restricted networks.

Confirm the Network Path First

Before changing Git config, validate that outbound access actually requires proxy and which protocol is allowed.

Quick checks:

bash
git --version
curl -I https://github.com

If direct curl fails but browser access works through enterprise proxy, Git likely needs explicit proxy configuration.

Also verify remote URL type:

bash
git remote -v
  • https://... remotes use HTTP proxy settings.
  • git@... remotes use SSH and are affected by different proxy rules.

Configure Proxy in Git

Set proxy for HTTP and HTTPS in Git config.

bash
git config --global http.proxy http://proxy.company.local:8080
git config --global https.proxy http://proxy.company.local:8080

If proxy requires credentials:

bash
git config --global http.proxy http://user:[email protected]:8080
git config --global https.proxy http://user:[email protected]:8080

For security, avoid plain-text password in shared machines. Prefer credential manager or environment-based injection handled by secure tooling.

Check applied values:

bash
git config --global --get http.proxy
git config --global --get https.proxy

Unset if wrong:

bash
git config --global --unset http.proxy
git config --global --unset https.proxy

Use Environment Variables for Session-Scoped Testing

Sometimes global config is not desirable. Use shell variables for temporary sessions.

bash
export http_proxy=http://proxy.company.local:8080
export https_proxy=http://proxy.company.local:8080
git ls-remote https://github.com/git/git.git

This helps compare behavior quickly without persistent config changes.

On Windows Git Bash, use the same export syntax in the current shell session.

Diagnose TLS Inspection and Certificates

Corporate proxies may terminate TLS and re-sign certificates. If proxy CA is not trusted by Git TLS backend, requests can timeout or fail with certificate errors.

Safer fix is adding corporate CA bundle, not disabling verification.

bash
git config --global http.sslCAInfo /path/to/corporate-ca.pem

Avoid this except emergency debugging:

bash
git config --global http.sslVerify false

Disabling verification creates security risk and should not be left enabled.

Timeout symptoms can also be bandwidth or packet inspection latency.

Useful knobs:

bash
git config --global http.lowSpeedLimit 1000
git config --global http.lowSpeedTime 60

This example says transfer below threshold for one minute is considered failure. Tune for your network profile.

You can also test protocol verbosity:

bash
GIT_TRACE=1 GIT_CURL_VERBOSE=1 git fetch

Verbose logs reveal whether timeout happens before proxy handshake, during TLS, or while transferring objects.

Proxy with SSH Remotes

If remote uses SSH, HTTP proxy settings will not help. Options include:

  • Switch remote URL to HTTPS.
  • Use SSH proxy command if company allows SSH via proxy tunnel.

Example SSH config snippet:

sshconfig
Host github.com
    HostName ssh.github.com
    Port 443

Exact corporate policy varies, so coordinate with network team.

Practical Recovery Workflow

When troubleshooting incident quickly:

  1. Verify remote protocol and proxy requirement.
  2. Test with temporary environment proxy variables.
  3. Apply Git global proxy once verified.
  4. Validate with git ls-remote before normal pull or push.
  5. Capture trace logs if failure persists and share with IT.

This sequence avoids random configuration churn and shortens resolution time.

Common Pitfalls

  • Setting only http.proxy and forgetting https.proxy. Fix by configuring both when using HTTPS remotes.
  • Leaving stale proxy values after moving networks. Fix by unsetting and rechecking config.
  • Embedding credentials in plain text config files. Fix by using secure credential management practices.
  • Disabling TLS verification permanently. Fix by installing trusted corporate CA certificate instead.
  • Troubleshooting HTTPS settings while remote is SSH. Fix by validating remote URL scheme first.

Summary

  • Git timeout behind proxy is usually configuration or certificate path mismatch.
  • Diagnose protocol and network path before tuning random settings.
  • Configure proxy with either Git config or session environment variables.
  • Use trace logging to locate exact failure stage.
  • Prefer secure certificate-based fixes over disabling TLS verification.

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design